Longer GPS position history for state monitoring

pull/20/head
Pawel Jalocha 2020-05-07 22:42:20 +01:00
rodzic 95c040b8c3
commit fb8ddaacfa
4 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -461,7 +461,7 @@ static void GPS_BurstComplete(void) // wh
}
uint8_t NextPosIdx = (PosIdx+1)&PosPipeIdxMask; // next position to be recorded
if( Position[PosIdx].isTimeValid() && Position[NextPosIdx].isTimeValid() )
{ int16_t Period = Position[PosIdx].calcTimeDiff(Position[NextPosIdx]);
{ int32_t Period = Position[PosIdx].calcTimeDiff(Position[NextPosIdx]);
if(Period>0) GPS_PosPeriod = (Period+GPS_PosPipeSize/2)/(GPS_PosPipeSize-1);
#ifdef DEBUG_PRINT
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
@ -475,7 +475,6 @@ static void GPS_BurstComplete(void) // wh
Format_String(CONS_UART_Write, "s\n");
xSemaphoreGive(CONS_Mutex);
#endif
}
Position[NextPosIdx].Clear(); // clear the next position
// int8_t Sec = Position[PosIdx].Sec; //

Wyświetl plik

@ -7,7 +7,11 @@
#include "lowpass2.h"
const uint8_t GPS_PosPipeSize = 4; // number of GPS positions held in a pipe
#ifdef WITH_ESP32
const uint8_t GPS_PosPipeSize = 32; // number of GPS positions held in a pipe
#else
const uint8_t GPS_PosPipeSize = 4; // number of GPS positions held in a pipe
#endif
// extern uint8_t GPS_PowerMode; // 0=shutdown, 1=reduced, 2=normal

Wyświetl plik

@ -1018,10 +1018,10 @@ class GPS_Position
calcLatitudeCosine();
return 1; }
int16_t calcTimeDiff(GPS_Position &RefPos) const
{ int16_t TimeDiff = (FracSec+(int16_t)Sec*100) - (RefPos.FracSec+(int16_t)RefPos.Sec*100);
if(TimeDiff<(-3000)) TimeDiff+=6000;
else if(TimeDiff>=3000) TimeDiff-=6000;
int32_t calcTimeDiff(GPS_Position &RefPos) const
{ int32_t TimeDiff = ((int32_t)Min*6000+(int16_t)Sec*100+FracSec) - ((int32_t)RefPos.Min*6000+(int16_t)RefPos.Sec*100+RefPos.FracSec);
if(TimeDiff<(-180000)) TimeDiff+=360000; // wrap-around 60min
else if(TimeDiff>=180000) TimeDiff-=360000;
return TimeDiff; } // [0.01s]
int16_t calcDifferentials(GPS_Position &RefPos) // calculate climb rate and turn rate with an earlier reference position

Wyświetl plik

@ -48,7 +48,7 @@ class FlashParameters
{ uint32_t Console;
struct
{ uint32_t CONbaud:24; // [bps] Console baud rate
uint8_t CONprot: 8; // [bit-mask] Console protocol mask: 0=minGPS, 1=allGPS, 2=Baro, 3=UBX, 4=OGN, 5=FLARM, 6=GDL90, 7=
uint8_t CONprot: 8; // [bit-mask] Console protocol mask: 0=minGPS, 1=allGPS, 2=Baro, 3=UBX, 4=OGN, 5=FLARM, 6=GDL90, 7=$PGAV5
} ;
} ;