use events to stay in idle state

This commit is contained in:
m1nl 2025-04-25 00:24:59 +02:00
parent 1d2a5c0692
commit 31c1d935f2
3 changed files with 6 additions and 4 deletions

View File

@ -130,7 +130,7 @@ static void lsIdle()
case ESP_SLEEP_WAKEUP_EXT0:
LOG_DEBUG("Wake cause ESP_SLEEP_WAKEUP_EXT0");
powerFSM.trigger(EVENT_LORA_INTERRUPT);
powerFSM.trigger(EVENT_RADIO_INTERRUPT);
return;
case ESP_SLEEP_WAKEUP_EXT1:
@ -383,10 +383,12 @@ void PowerFSM_setup()
// when we leave, go to ON (which might not be the correct state if we have power connected, we will fix that in onEnter)
powerFSM.add_transition(&stateSERIAL, &stateON, EVENT_SERIAL_DISCONNECTED, NULL, "Serial disconnect");
powerFSM.add_transition(&stateLS, stateIDLE, EVENT_LORA_INTERRUPT, NULL, "LoRa interrupt");
powerFSM.add_transition(&stateLS, stateIDLE, EVENT_WAKE_TIMER, NULL, "Wake timer");
powerFSM.add_transition(&stateLS, stateIDLE, EVENT_RADIO_INTERRUPT, NULL, "Radio interrupt");
powerFSM.add_transition(stateIDLE, stateIDLE, EVENT_WAKE_TIMER, NULL, "Wake timer");
powerFSM.add_transition(stateIDLE, stateIDLE, EVENT_WEB_REQUEST, NULL, "Web request");
powerFSM.add_transition(stateIDLE, stateIDLE, EVENT_RADIO_INTERRUPT, NULL, "Radio interrupt");
#ifdef USE_EINK
// Allow E-Ink devices to suppress the screensaver, if screen timeout set to 0

View File

@ -21,7 +21,7 @@
#define EVENT_FIRMWARE_UPDATE 15 // We just received a new firmware update packet from the phone
#define EVENT_SHUTDOWN 16 // force a full shutdown now (not just sleep)
#define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen
#define EVENT_LORA_INTERRUPT 18
#define EVENT_RADIO_INTERRUPT 18
#define EVENT_WEB_REQUEST 19
#if defined(ARCH_ESP32) && !defined(WAKE_TIME_MS)

View File

@ -246,7 +246,7 @@ currently active.
*/
void RadioLibInterface::onNotify(uint32_t notification)
{
powerFSM.trigger(EVENT_LORA_INTERRUPT);
powerFSM.trigger(EVENT_RADIO_INTERRUPT);
switch (notification) {
case ISR_TX: