From 6b5024970a1b6925450ac56cd19d1253bf4e358e Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Sat, 21 May 2022 20:28:24 +0100 Subject: [PATCH] Store the flight state in the GPS structure --- main/gps.cpp | 4 ++-- main/ogn.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main/gps.cpp b/main/gps.cpp index 2c6824b..3f8ee35 100644 --- a/main/gps.cpp +++ b/main/gps.cpp @@ -117,7 +117,7 @@ static uint32_t RndID_TimeToChange = 0; void FlightProcess(void) { bool PrevInFlight=Flight.inFlight(); Flight.Process(GPS_Pos[GPS_PosIdx]); - bool InFlight=Flight.inFlight(); + GPS.InFlight=Flight.inFlight(); if(Parameters.AddrType!=0) return; uint32_t Random = GPS_Random^RX_Random; if(RndID_TimeToChange==0) @@ -136,7 +136,7 @@ void FlightProcess(void) // Format_String(CONS_UART_Write, "\n"); xSemaphoreGive(CONS_Mutex); } RndID_TimeToChange--; } - if(PrevInFlight==1 && InFlight==0) RndID_TimeToChange+=20; + if(PrevInFlight==1 && GPS.InFlight==0) RndID_TimeToChange+=20; } // ---------------------------------------------------------------------------- diff --git a/main/ogn.h b/main/ogn.h index a4d601e..8e3dc4a 100644 --- a/main/ogn.h +++ b/main/ogn.h @@ -898,6 +898,7 @@ class GPS_Position: public GPS_Time bool hasGSV :1; bool isReady :1; // is ready for the following treaement bool Sent :1; // has been transmitted + bool InFlight :1; // take-off and landing detection } ; } ;