diff --git a/src/main.cpp b/src/main.cpp index 7a11ca2e0..95a5a20e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -543,12 +543,14 @@ void setup() tftSetup(); #endif +#if defined(HAS_PMU) // Currently only the tbeam has a PMU // PMU initialization needs to be placed before i2c scanning power = new Power(); power->setStatusHandler(powerStatus); powerStatus->observe(&power->newStatus); power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration +#endif #if !MESHTASTIC_EXCLUDE_I2C // We need to scan here to decide if we have a screen for nodeDB.init() and because power has been applied to @@ -1289,6 +1291,15 @@ void setup() 1000); } +#if !defined(HAS_PMU) + // Currently only the tbeam has a PMU + // PMU initialization needs to be placed before i2c scanning + power = new Power(); + power->setStatusHandler(powerStatus); + powerStatus->observe(&power->newStatus); + power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration +#endif + // This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS powerFSMthread = new PowerFSMThread();