From 5c4ae6c042df58ae5f4263a8a13b66bbadb3f52f Mon Sep 17 00:00:00 2001 From: geeksville Date: Fri, 27 Mar 2020 12:37:47 -0700 Subject: [PATCH] now that axp192 interrups work, no need to poll over i2c. #48 --- src/main.cpp | 58 ++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 18b094f7..3dc0fa2e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -342,46 +342,38 @@ void loop() // for debug printing // service.radio.rf95.canSleep(); -#ifdef T_BEAM_V10 - if (axp192_found) { #ifdef PMU_IRQ - if (pmu_irq) { - pmu_irq = false; - axp.readIRQ(); + if (pmu_irq) { + pmu_irq = false; + axp.readIRQ(); - DEBUG_MSG("pmu irq!\n"); + DEBUG_MSG("pmu irq!\n"); - if (axp.isChargingIRQ()) { - DEBUG_MSG("Battery start charging\n"); - } - if (axp.isChargingDoneIRQ()) { - DEBUG_MSG("Battery fully charged\n"); - } - if (axp.isVbusRemoveIRQ()) { - DEBUG_MSG("USB unplugged\n"); - } - if (axp.isVbusPlugInIRQ()) { - DEBUG_MSG("USB plugged In\n"); - } - if (axp.isBattPlugInIRQ()) { - DEBUG_MSG("Battery inserted\n"); - } - if (axp.isBattRemoveIRQ()) { - DEBUG_MSG("Battery removed\n"); - } - if (axp.isPEKShortPressIRQ()) { - DEBUG_MSG("PEK short button press\n"); - } - - isCharging = axp.isChargeing() ? 1 : 0; - isUSBPowered = axp.isVBUSPlug() ? 1 : 0; - axp.clearIRQ(); + if (axp.isChargingIRQ()) { + DEBUG_MSG("Battery start charging\n"); + } + if (axp.isChargingDoneIRQ()) { + DEBUG_MSG("Battery fully charged\n"); + } + if (axp.isVbusRemoveIRQ()) { + DEBUG_MSG("USB unplugged\n"); + } + if (axp.isVbusPlugInIRQ()) { + DEBUG_MSG("USB plugged In\n"); + } + if (axp.isBattPlugInIRQ()) { + DEBUG_MSG("Battery inserted\n"); + } + if (axp.isBattRemoveIRQ()) { + DEBUG_MSG("Battery removed\n"); + } + if (axp.isPEKShortPressIRQ()) { + DEBUG_MSG("PEK short button press\n"); } - // FIXME AXP192 interrupt is not firing, remove this temporary polling of battery state isCharging = axp.isChargeing() ? 1 : 0; isUSBPowered = axp.isVBUSPlug() ? 1 : 0; -#endif + axp.clearIRQ(); } #endif