From d23bc3535ed93b8d7a8242cdfc4b82dccf508f78 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 29 Dec 2020 00:21:40 +0100 Subject: [PATCH] enter_deepsleep cleanup wait logic --- src/reset.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/reset.cpp b/src/reset.cpp index e5961d75..8332589d 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -117,10 +117,9 @@ void enter_deepsleep(const uint64_t wakeup_sec = 60, // wait a while (max 100 sec) to clear send queues ESP_LOGI(TAG, "Waiting until send queues are empty..."); for (i = 100; i > 0; i--) { - if (!allQueuesEmtpy()) - vTaskDelay(pdMS_TO_TICKS(1000)); - else + if (allQueuesEmtpy()) break; + vTaskDelay(pdMS_TO_TICKS(1000)); } // shutdown LMIC safely, waiting max 100 sec