From cf45f7ee8151d71b66c5a90af956d2bbfef25434 Mon Sep 17 00:00:00 2001 From: vk7js <58905135+vk7js@users.noreply.github.com> Date: Thu, 15 Sep 2022 18:40:11 +1000 Subject: [PATCH] Fixed missing gps updates due to recording an update even when one wasn't detected, this meant countdown would restart errantly. --- openrtx/src/ui/ui.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 6f15f2f1..5f0850f2 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -1136,7 +1136,7 @@ void ui_saveState() #ifdef GPS_PRESENT static float priorGPSSpeed = 0; static float priorGPSAltitude = 0; -static float priorGPSDirection = 0; +static float priorGPSDirection = 500; // impossible value init. static uint32_t vpGPSLastUpdate = 0; static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged() @@ -1150,8 +1150,6 @@ static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged() if (now - vpGPSLastUpdate < 10000) return vpGPSNone; - vpGPSLastUpdate=now; - vpGPSInfoFlags_t whatChanged= vpGPSNone; if (state.gps_data.fix_quality != priorGPSFixQuality) @@ -1187,6 +1185,9 @@ static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged() priorGPSDirection = state.gps_data.tmg_true; } + if (whatChanged) + vpGPSLastUpdate=now; + return whatChanged; } #endif // GPS_PRESENT