From 2af4c619e1dc085033f40bc5ca42f1a402fbdc9d Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Mon, 2 Aug 2021 21:07:32 -0700 Subject: [PATCH] fix #801 (I think) we were sometimes dropping packets in light sleep Because of failure to enter the NB state packets were not getting queued for sending. --- src/PowerFSM.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 53ba66aa2..3412bdf32 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -41,7 +41,7 @@ static void lsEnter() screen->setOn(false); secsSlept = 0; // How long have we been sleeping this time - DEBUG_MSG("lsEnter end\n"); + // DEBUG_MSG("lsEnter end\n"); } static void lsIdle() @@ -226,8 +226,8 @@ void PowerFSM_setup() // if we are a router node, we go to NB (no need for bluetooth) otherwise we go to DARK (so we can send message to phone) powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer"); - // Note we don't really use this transition, because when we wake from light sleep we _always_ transition to NB or dark and - // then it handles things powerFSM.add_transition(&stateLS, &stateNB, EVENT_RECEIVED_PACKET, NULL, "Received packet"); + // We need this transition, because we might not transition if we were waiting to enter light-sleep, because when we wake from light sleep we _always_ transition to NB or dark and + powerFSM.add_transition(&stateLS, &stateNB, EVENT_RECEIVED_PACKET, NULL, "Received packet"); powerFSM.add_transition(&stateNB, &stateNB, EVENT_RECEIVED_PACKET, NULL, "Received packet, resetting win wake");