From deaf10ed53133adab73c4937cdfa4351642b6848 Mon Sep 17 00:00:00 2001 From: Bertrand Lemasle Date: Thu, 3 May 2018 23:39:52 +1200 Subject: [PATCH] Stopped at boot up means going to long sleep. Fixed long sleep would result in a backup each time --- GpsTracker/Core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GpsTracker/Core.cpp b/GpsTracker/Core.cpp index 4c09c27..e03dc09 100644 --- a/GpsTracker/Core.cpp +++ b/GpsTracker/Core.cpp @@ -8,7 +8,7 @@ using namespace utils; namespace core { uint16_t sleepTime = SLEEP_DEFAULT_TIME_SECONDS; - uint8_t stoppedInARow = 0; + uint8_t stoppedInARow = SLEEP_DEFAULT_STOPPED_THRESHOLD - 1; void main() { bool forceBackup = false; @@ -32,7 +32,7 @@ namespace core { if (stoppedInARow < SLEEP_DEFAULT_STOPPED_THRESHOLD) { result = SLEEP_DEFAULT_PAUSING_TIME_SECONDS; } - else goingLongSleep = true; + else if(stoppedInARow == SLEEP_DEFAULT_STOPPED_THRESHOLD) goingLongSleep = true; } else stoppedInARow = 0;