mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 10:21:40 +00:00
Fix for #535 -- Heltec board stays asleep ...
This commit is contained in:
parent
ef0891ae5d
commit
5f97740ab7
@ -144,12 +144,12 @@ static void onEnter()
|
|||||||
|
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
|
|
||||||
if (now - lastPingMs > 30 * 1000) { // if more than a minute since our last press, ask node we are looking at to update their state
|
if (now - lastPingMs >
|
||||||
|
30 * 1000) { // if more than a minute since our last press, ask node we are looking at to update their state
|
||||||
if (displayedNodeNum)
|
if (displayedNodeNum)
|
||||||
service.sendNetworkPing(displayedNodeNum, true); // Refresh the currently displayed node
|
service.sendNetworkPing(displayedNodeNum, true); // Refresh the currently displayed node
|
||||||
lastPingMs = now;
|
lastPingMs = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void screenPress()
|
static void screenPress()
|
||||||
@ -174,7 +174,12 @@ void PowerFSM_setup()
|
|||||||
// If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON
|
// If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON
|
||||||
// We assume routers might be powered all the time, but from a low current (solar) source
|
// We assume routers might be powered all the time, but from a low current (solar) source
|
||||||
bool isLowPower = radioConfig.preferences.is_low_power;
|
bool isLowPower = radioConfig.preferences.is_low_power;
|
||||||
bool hasPower = !isLowPower && powerStatus && powerStatus->getHasUSB();
|
|
||||||
|
/* To determine if we're externally powered, assumptions
|
||||||
|
1) If we're powered up and there's no battery, we must be getting power externally.
|
||||||
|
2) If we detect USB power from the power management chip, we must be getting power externally.
|
||||||
|
*/
|
||||||
|
bool hasPower = (powerStatus && !powerStatus->getHasBattery()) || !isLowPower && powerStatus && powerStatus->getHasUSB();
|
||||||
bool isRouter = radioConfig.preferences.is_router;
|
bool isRouter = radioConfig.preferences.is_router;
|
||||||
DEBUG_MSG("PowerFSM init, USB power=%d\n", hasPower);
|
DEBUG_MSG("PowerFSM init, USB power=%d\n", hasPower);
|
||||||
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
|
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
|
||||||
|
Loading…
Reference in New Issue
Block a user