From 598023f5db2f61f221b3dfd005580d39cf2e0e8e Mon Sep 17 00:00:00 2001 From: geeksville Date: Fri, 21 Feb 2020 11:39:10 -0800 Subject: [PATCH] PMU IRQ polarity was backwards --- src/configuration.h | 4 ++-- src/main.ino | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index c37feaf79..98e7731a1 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -43,8 +43,8 @@ along with this program. If not, see . // Select which board is being used. If the outside build environment has sent a choice, just use that #if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32) -//#define T_BEAM_V10 // AKA Rev1 (second board released) -#define HELTEC_LORA32 +#define T_BEAM_V10 // AKA Rev1 (second board released) +//#define HELTEC_LORA32 #define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the correct build #endif diff --git a/src/main.ino b/src/main.ino index 3f5b1642d..45a9ece90 100644 --- a/src/main.ino +++ b/src/main.ino @@ -223,7 +223,7 @@ void doLightSleep(uint32_t sleepMsec = 20 * 1000) // FIXME, use a more reasonabl gpio_wakeup_enable((gpio_num_t)BUTTON_PIN, GPIO_INTR_LOW_LEVEL); // when user presses, this button goes low gpio_wakeup_enable((gpio_num_t)DIO0_GPIO, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high #ifdef PMU_IRQ - gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_LOW_LEVEL); // pmu irq + gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_HIGH_LEVEL); // pmu irq #endif esp_sleep_enable_gpio_wakeup(); esp_sleep_enable_timer_wakeup(sleepUsec); @@ -378,7 +378,7 @@ void axp192Init() attachInterrupt(PMU_IRQ, [] { pmu_irq = true; }, - FALLING); + RISING); axp.adc1Enable(AXP202_BATT_CUR_ADC1, 1); axp.enableIRQ(AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_BATT_REMOVED_IRQ | AXP202_BATT_CONNECT_IRQ, 1); @@ -550,6 +550,8 @@ void loop() pmu_irq = false; axp.readIRQ(); + DEBUG_MSG("pmu irq!\n"); + isCharging = axp.isChargeing(); isUSBPowered = axp.isVBUSPlug();