Skip to content

Commit

Permalink
bug meshtastic#376 - stop using pmu IRQ - we don't need it and it cau…
Browse files Browse the repository at this point in the history
…ses LS wakes
  • Loading branch information
geeksville committed Oct 6, 2020
1 parent 943d5cb commit 7854a22
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/software/gps-todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ bin/run.sh --set region 8
time only mode
./bin/run.sh --set gps_operation 3

fix wake behavior when message arrives on lora
record power measurements and update spreadsheet

do new power measurements
fix uart wake from sleep

fix has_gps based on new logic

Expand Down
7 changes: 5 additions & 2 deletions src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,11 @@ bool Power::axp192Init()
PMU_IRQ, [] { pmu_irq = true; }, FALLING);

axp.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
axp.enableIRQ(AXP202_BATT_REMOVED_IRQ | AXP202_BATT_CONNECT_IRQ | AXP202_CHARGING_FINISHED_IRQ | AXP202_CHARGING_IRQ |
AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_PEK_SHORTPRESS_IRQ,
// we do not look for AXP202_CHARGING_FINISHED_IRQ & AXP202_CHARGING_IRQ because it occurs repeatedly while there is
// no battery also it could cause inadvertent waking from light sleep just because the battery filled
// we don't look for AXP202_BATT_REMOVED_IRQ because it occurs repeatedly while no battery installed
// we don't look at AXP202_VBUS_REMOVED_IRQ because we don't have anything hooked to vbus
axp.enableIRQ(AXP202_BATT_CONNECT_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_PEK_SHORTPRESS_IRQ,
1);

axp.clearIRQ();
Expand Down
5 changes: 3 additions & 2 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// code)
#endif

// Leave undefined to disable our PMU IRQ handler
#define PMU_IRQ 35
// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
// and waking from light sleep
// #define PMU_IRQ 35
#define AXP192_SLAVE_ADDRESS 0x34

#elif defined(TBEAM_V07)
Expand Down
4 changes: 2 additions & 2 deletions src/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void doDeepSleep(uint64_t msecToWake)

// axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); // LORA radio

// now done by UBloxGPS.cpp
// now done by UBloxGPS.cpp
// setGPSPower(false);
}
#endif
Expand Down Expand Up @@ -275,7 +275,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
gpio_wakeup_enable((gpio_num_t)RF95_IRQ_GPIO, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high
#endif
#ifdef PMU_IRQ
// FIXME, disable wake due to PMU because it seems to fire all the time?
// wake due to PMU can happen repeatedly if there is no battery installed or the battery fills
if (axp192_found)
gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_LOW_LEVEL); // pmu irq
#endif
Expand Down

0 comments on commit 7854a22

Please sign in to comment.