From 0894a1cb0e863f00496705f2009707c9695ef93c Mon Sep 17 00:00:00 2001 From: Bertrand Lemasle Date: Sun, 20 May 2018 22:18:57 +1200 Subject: [PATCH] Fixed long pause detection would never occur because of the use of max instead of min --- GpsTracker/Core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GpsTracker/Core.cpp b/GpsTracker/Core.cpp index 7f662d3..386e33d 100644 --- a/GpsTracker/Core.cpp +++ b/GpsTracker/Core.cpp @@ -33,7 +33,7 @@ namespace core { if (velocity < SLEEP_TIMING_MIN_MOVING_VELOCITY) { float distance = gps::getDistanceFromPrevious(); //did we missed positions because we were sleeping ? if (distance > GPS_DEFAULT_MISSED_POSITION_GAP_KM) stoppedInARow = 0; - else stoppedInARow = max(stoppedInARow + 1, SLEEP_DEFAULT_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops + else stoppedInARow = min(stoppedInARow + 1, SLEEP_DEFAULT_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops if (stoppedInARow < SLEEP_DEFAULT_STOPPED_THRESHOLD) { result = SLEEP_DEFAULT_PAUSING_TIME_SECONDS;