kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Porównaj commity
4 Commity
ae91503a71
...
adcbeda815
Autor | SHA1 | Data |
---|---|---|
Pawel Jalocha | adcbeda815 | |
Pawel Jalocha | f448e4cf8b | |
Pawel Jalocha | 916765929b | |
Pawel Jalocha | 196589f2dc |
|
@ -173,6 +173,7 @@ static void ProcessGSV(NMEA_RxMsg &GSV) // process GxGSV to extract
|
|||
if(GSV.isGPGSV()) { SatSys=0; }
|
||||
else if(GSV.isGLGSV()) { SatSys=1; }
|
||||
else if(GSV.isGAGSV()) { SatSys=2; }
|
||||
else if(GSV.isBDGSV()) { SatSys=3; }
|
||||
else return;
|
||||
if(GSV.Parms<3) return;
|
||||
int8_t Pkts=Read_Dec1((const char *)GSV.ParmPtr(0)); if(Pkts<0) return; // how many packets to pass all sats
|
||||
|
|
38
main/log.cpp
38
main/log.cpp
|
@ -292,12 +292,12 @@ static int FlashLog_Open(uint32_t Time) // open a new
|
|||
if(FlashLog_File==0) FlashLog_Clean(0, 4); // if the file cannot be open clean again
|
||||
return FlashLog_File!=0; } // 1=success, 0=failure: new log file could not be open
|
||||
|
||||
static void FlashLog_Reopen(void)
|
||||
{ if(FlashLog_File)
|
||||
{ fclose(FlashLog_File);
|
||||
FlashLog_File = fopen(FlashLog_FileName, "ab");
|
||||
FlashLog_FileFlush = ftell(FlashLog_File); }
|
||||
FlashLog_SaveReq=0; }
|
||||
static void FlashLog_Reopen(void) // force close and re-open the current log file
|
||||
{ if(FlashLog_File) // if log File is open
|
||||
{ fclose(FlashLog_File); // close it
|
||||
FlashLog_File = fopen(FlashLog_FileName, "ab"); // open it again for append with same filename
|
||||
FlashLog_FileFlush = ftell(FlashLog_File); } // track how much has been pysically written
|
||||
FlashLog_SaveReq=0; } // clear q possible request to save the file
|
||||
|
||||
static int FlashLog_Record(OGN_LogPacket<OGN_Packet> *Packet, int Packets, uint32_t Time) // log a batch of OGN packets
|
||||
{ if(FlashLog_File) // if log file already open
|
||||
|
@ -381,27 +381,23 @@ void vTaskLOG(void* pvParameters)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
TickType_t PrevTick = 0;
|
||||
TickType_t PrevTick = 0; // [ms] Time when packets stored the last time
|
||||
for( ; ; )
|
||||
{ // vTaskDelay(200); // wait idle 0.2sec
|
||||
if(FlashLog_SaveReq) FlashLog_Reopen(); // if requested then save the current log (close + reopen)
|
||||
TickType_t Tick=xTaskGetTickCount(); // system tick count now
|
||||
{ vTaskDelay(1);
|
||||
bool Flying = Flight.inFlight(); // if the aircraft flying ?
|
||||
size_t Packets = FlashLog_FIFO.Full(); // how many packets in the queue ?
|
||||
// #ifdef DEBUG_PRINT
|
||||
// xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||
// Format_String(CONS_UART_Write, "TaskLOG() ");
|
||||
// Format_UnsDec(CONS_UART_Write, Tick, 4, 3);
|
||||
// Format_String(CONS_UART_Write, "(");
|
||||
// Format_UnsDec(CONS_UART_Write, PrevTick, 4, 3);
|
||||
// Format_String(CONS_UART_Write, ")s: ");
|
||||
// Format_UnsDec(CONS_UART_Write, Packets);
|
||||
// Format_String(CONS_UART_Write, " packets\n");
|
||||
// xSemaphoreGive(CONS_Mutex);
|
||||
// #endif
|
||||
if(Flying) // when flying
|
||||
{ if(FlashLog_SaveReq) FlashLog_Reopen(); // if requested then save the current log (close + reopen)
|
||||
TickType_t Tick=xTaskGetTickCount(); // system tick count now
|
||||
if(Packets==0) { PrevTick=Tick; vTaskDelay(100); continue; } // if none: then give up
|
||||
if(Packets>=8) { Copy(); PrevTick=Tick; continue; } // if 8 or more packets then copy them to the log file
|
||||
TickType_t Diff = Tick-PrevTick; // time since last log action
|
||||
if(Diff>=8000) { Copy(); PrevTick=Tick; continue; } // if more than 8.0sec than copy the packets
|
||||
} else // when not flying
|
||||
{ if(FlashLog_File) { fclose(FlashLog_File); FlashLog_File=0; } // if file open then close it
|
||||
while(FlashLog_FIFO.Full()>=FlashLog_FIFO.Len/2) // flush the packet queue but keep it half-full
|
||||
{ FlashLog_FIFO.Read(); vTaskDelay(1); }
|
||||
}
|
||||
vTaskDelay(100); }
|
||||
|
||||
}
|
||||
|
|
|
@ -207,6 +207,12 @@ inline uint8_t NMEA_AppendCheckCRNL(char *NMEA, uint8_t Len) { return NMEA_Appen
|
|||
if(Data[4]!='S') return 0;
|
||||
return Data[5]=='V'; }
|
||||
|
||||
uint8_t isBDGSV(void) const // BEIDOU satellite data
|
||||
{ if(!isBD()) return 0;
|
||||
if(Data[3]!='G') return 0;
|
||||
if(Data[4]!='S') return 0;
|
||||
return Data[5]=='V'; }
|
||||
|
||||
uint8_t isGPTXT(void) const // GPS test message
|
||||
{ if(!isGP()) return 0;
|
||||
if(Data[3]!='T') return 0;
|
||||
|
|
12
main/ogn.h
12
main/ogn.h
|
@ -980,13 +980,13 @@ class GPS_Position: public GPS_Time
|
|||
int PrintTime(char *Out) const { return sprintf(Out, "%02d:%02d:%02d.%03d", Hour, Min, Sec, mSec ); }
|
||||
|
||||
void Print(void) const
|
||||
{ printf("Time/Date = "); PrintDateTime(); printf(" "); // printf(" = %10ld.%03dsec\n", (long int)UnixTime, mSec);
|
||||
printf("FixQuality/Mode=%d/%d: %d satellites DOP/H/V=%3.1f/%3.1f/%3.1f ", FixQuality, FixMode, Satellites, 0.1*PDOP, 0.1*HDOP, 0.1*VDOP);
|
||||
printf("FixQuality=%d: %d satellites HDOP=%3.1f ", FixQuality, Satellites, 0.1*HDOP);
|
||||
printf("Lat/Lon/Alt = [%+10.6f,%+10.6f]deg %+3.1f(%+3.1f)m LatCosine=%+6.3f ", 0.0001/60*Latitude, 0.0001/60*Longitude, 0.1*Altitude, 0.1*GeoidSeparation, 1.0/(1<<12)*LatitudeCosine);
|
||||
{ printf("Time/Date: "); PrintDateTime();
|
||||
printf(" FixQual/Mode=%d/%d: %d sats DOP/H/V=%3.1f/%3.1f/%3.1f", FixQuality, FixMode, Satellites, 0.1*PDOP, 0.1*HDOP, 0.1*VDOP);
|
||||
printf(" Lat/Lon/Alt = [%+10.6f,%+10.6f]deg %+3.1f(%+3.1f)m LatCos=%+6.3f", 0.0001/60*Latitude, 0.0001/60*Longitude, 0.1*Altitude, 0.1*GeoidSeparation, 1.0/(1<<12)*LatitudeCosine);
|
||||
printf(" Speed/Heading = %3.1fm/s %05.1fdeg", 0.1*Speed, 0.1*Heading);
|
||||
printf("Climb = %+5.1fm/s Turn = %+5.1fdeg/sec\n", 0.1*ClimbRate, 0.1*TurnRate);
|
||||
}
|
||||
printf(" Climb = %+5.1fm/s", 0.1*ClimbRate);
|
||||
printf(" Turn = %+5.1fdeg/s", 0.1*TurnRate);
|
||||
printf("\n"); }
|
||||
|
||||
int Print(char *Out) const
|
||||
{ int Len=0;
|
||||
|
|
|
@ -489,7 +489,7 @@ extern "C"
|
|||
xSemaphoreGive(CONS_Mutex); }
|
||||
}
|
||||
else // if no WAN reception expected or possible
|
||||
#else // WITH_LORAWAN
|
||||
#endif // WITH_LORAWAN
|
||||
// if(TimeSync_msTime()<260);
|
||||
{ uint32_t RxRssiSum=0; uint16_t RxRssiCount=0; // measure the average RSSI for lower frequency
|
||||
do
|
||||
|
@ -513,7 +513,7 @@ extern "C"
|
|||
xSemaphoreGive(CONS_Mutex);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
// #endif // WITH_LORAWAN
|
||||
|
||||
TRX.setModeStandby(); // switch to standy
|
||||
vTaskDelay(1);
|
||||
|
|
Ładowanie…
Reference in New Issue