kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Add status packet print when downloading the log file
rodzic
8cb4462c2d
commit
f6f50c57f8
|
@ -174,7 +174,7 @@ int FlashLog_ListFiles(void) //
|
||||||
return Files; }
|
return Files; }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int FlashLog_ListFile(const char *FileName, uint32_t FileTime) // print the content, thue every packet of the given log file in APRS format
|
int FlashLog_ListFile(const char *FileName, uint32_t FileTime) // print the content, thus every packet of the given log file in APRS format
|
||||||
{ char Line[128];
|
{ char Line[128];
|
||||||
// xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
// xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
// Format_String(CONS_UART_Write, "FlashLog_ListFile(");
|
// Format_String(CONS_UART_Write, "FlashLog_ListFile(");
|
||||||
|
@ -187,10 +187,11 @@ int FlashLog_ListFile(const char *FileName, uint32_t FileTime) // print the c
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{ if(fread(&Packet, Packet.Bytes, 1, File)!=1) break; // read the next packet
|
{ if(fread(&Packet, Packet.Bytes, 1, File)!=1) break; // read the next packet
|
||||||
if(!Packet.isCorrect()) continue;
|
if(!Packet.isCorrect()) continue;
|
||||||
if(Packet.Packet.Header.NonPos) continue; // skip non-position packets (although we could print them too)
|
// if(Packet.Packet.Header.NonPos) continue; // skip non-position packets (although we could print them too)
|
||||||
uint32_t Time = Packet.getTime(FileTime); // [sec] get exact time from short time in the packet and the file start time
|
uint32_t Time = Packet.getTime(FileTime); // [sec] get exact time from short time in the packet and the file start time
|
||||||
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
|
||||||
uint8_t Len=Packet.Packet.WriteAPRS(Line, Time); // print the packet in the APRS format
|
uint8_t Len=Packet.Packet.WriteAPRS(Line, Time); // print the packet in the APRS format
|
||||||
|
if(Len==0) continue; // if cannot be printed for whatever reason
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
Format_String(CONS_UART_Write, Line, 0, Len); // send the APRS to the console
|
Format_String(CONS_UART_Write, Line, 0, Len); // send the APRS to the console
|
||||||
xSemaphoreGive(CONS_Mutex);
|
xSemaphoreGive(CONS_Mutex);
|
||||||
vTaskDelay(10); // limit the printout to some 100 packet/sec
|
vTaskDelay(10); // limit the printout to some 100 packet/sec
|
||||||
|
|
27
main/ogn1.h
27
main/ogn1.h
|
@ -175,14 +175,31 @@ class OGN1_Packet // Packet structure for the OGN tracker
|
||||||
{ printf(" %02X", Byte()[Idx]); }
|
{ printf(" %02X", Byte()[Idx]); }
|
||||||
printf("\n"); }
|
printf("\n"); }
|
||||||
|
|
||||||
int WriteDeviceStatus(char *Out)
|
uint8_t WriteStatus(char *Out)
|
||||||
|
{ uint8_t Len=0;
|
||||||
|
Out[Len++]=' '; Out[Len++]='h'; Len+=Format_Hex(Out+Len, (uint8_t)Status.Hardware);
|
||||||
|
Out[Len++]=' '; Out[Len++]='v'; Len+=Format_Hex(Out+Len, (uint8_t)Status.Firmware);
|
||||||
|
Out[Len++]=' '; Len+=Format_UnsDec(Out+Len, Status.Satellites); Out[Len++]='s'; Out[Len++]='a'; Out[Len++]='t';
|
||||||
|
Out[Len++]='/'; Out[Len++]='0'+Status.FixQuality;
|
||||||
|
Out[Len++]='/'; Len+=Format_UnsDec(Out+Len, Status.SatSNR+8); Out[Len++]='d'; Out[Len++]='B';
|
||||||
|
Out[Len++]=' '; Len+=Format_SignDec(Out+Len, DecodeAltitude(), 1, 0, 1); Out[Len++]='m';
|
||||||
|
Out[Len++]=' '; Len+=Format_UnsDec(Out+Len, (((uint32_t)Status.Pressure<<3)+5)/10, 2, 1); Out[Len++]='h'; Out[Len++]='P'; Out[Len++]='a';
|
||||||
|
Out[Len++]=' '; Len+=Format_SignDec(Out+Len, DecodeTemperature(), 2, 1); Out[Len++]='d'; Out[Len++]='e'; Out[Len++]='g'; Out[Len++]='C';
|
||||||
|
Out[Len++]=' '; Len+=Format_SignDec(Out+Len, DecodeHumidity(), 2, 1); Out[Len++]='%';
|
||||||
|
Out[Len++]=' '; Len+=Format_SignDec(Out+Len, ((uint32_t)DecodeVoltage()*100+32)>>6, 3, 2); Out[Len++]='V';
|
||||||
|
Out[Len++]=' '; Len+=Format_UnsDec(Out+Len, Status.TxPower+4);
|
||||||
|
Out[Len++]='/'; Out[Len++]='-'; Len+=Format_UnsDec(Out+Len, 5*Status.RadioNoise, 2, 1); Out[Len++]='d'; Out[Len++]='B'; Out[Len++]='m';
|
||||||
|
Out[Len++]=' '; Len+=Format_UnsDec(Out+Len, (1<<Status.RxRate)-1); Out[Len++]='/'; Out[Len++]='m'; Out[Len++]='i'; Out[Len++]='n';
|
||||||
|
return Len; }
|
||||||
|
|
||||||
|
uint8_t WriteDeviceStatus(char *Out)
|
||||||
{ return sprintf(Out, " h%02X v%02X %dsat/%d/%ddB %ldm %3.1fhPa %+4.1fdegC %3.1f%% %4.2fV %d/%+4.1fdBm %d/min",
|
{ return sprintf(Out, " h%02X v%02X %dsat/%d/%ddB %ldm %3.1fhPa %+4.1fdegC %3.1f%% %4.2fV %d/%+4.1fdBm %d/min",
|
||||||
Status.Hardware, Status.Firmware, Status.Satellites, Status.FixQuality, 8+Status.SatSNR, (long int)DecodeAltitude(),
|
Status.Hardware, Status.Firmware, Status.Satellites, Status.FixQuality, 8+Status.SatSNR, (long int)DecodeAltitude(),
|
||||||
0.08*Status.Pressure, 0.1*DecodeTemperature(), 0.1*DecodeHumidity(),
|
0.08*Status.Pressure, 0.1*DecodeTemperature(), 0.1*DecodeHumidity(),
|
||||||
(1.0/64)*DecodeVoltage(), Status.TxPower+4, -0.5*Status.RadioNoise, (1<<Status.RxRate)-1 );
|
(1.0/64)*DecodeVoltage(), Status.TxPower+4, -0.5*Status.RadioNoise, (1<<Status.RxRate)-1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int WriteDeviceInfo(char *Out)
|
uint8_t WriteDeviceInfo(char *Out)
|
||||||
{ int Len=0;
|
{ int Len=0;
|
||||||
char Value[16];
|
char Value[16];
|
||||||
uint8_t InfoType;
|
uint8_t InfoType;
|
||||||
|
@ -501,14 +518,18 @@ class OGN1_Packet // Packet structure for the OGN tracker
|
||||||
{ memcpy(Msg+Len, ",RELAY*", 7); Len+=7; }
|
{ memcpy(Msg+Len, ",RELAY*", 7); Len+=7; }
|
||||||
Msg[Len++] = ':';
|
Msg[Len++] = ':';
|
||||||
|
|
||||||
|
if(Header.NonPos && Status.ReportType!=0) return 0; // give up if neither position nor status
|
||||||
|
|
||||||
if(Position.Time<60)
|
if(Position.Time<60)
|
||||||
{ uint32_t DayTime=Time%86400; int Sec=DayTime%60; // second of the time the packet was recevied
|
{ uint32_t DayTime=Time%86400; int Sec=DayTime%60; // second of the time the packet was recevied
|
||||||
int DiffSec=Position.Time-Sec; if(DiffSec>4) DiffSec-=60; // difference should always be zero or negative, but can be small positive for predicted positions
|
int DiffSec=Position.Time-Sec; if(DiffSec>4) DiffSec-=60; // difference should always be zero or negative, but can be small positive for predicted positions
|
||||||
Time+=DiffSec; } // get out the correct position time
|
Time+=DiffSec; } // get out the correct position time
|
||||||
Msg[Len++] = '/';
|
Msg[Len++] = Header.NonPos?'>':'/';
|
||||||
Len+=Format_HHMMSS(Msg+Len, Time);
|
Len+=Format_HHMMSS(Msg+Len, Time);
|
||||||
Msg[Len++] = 'h';
|
Msg[Len++] = 'h';
|
||||||
|
|
||||||
|
if(Header.NonPos) { Len+=WriteStatus(Msg+Len); Msg[Len++]='\n'; Msg[Len]=0; return Len; }
|
||||||
|
|
||||||
const char *Icon = getAprsIcon(Position.AcftType);
|
const char *Icon = getAprsIcon(Position.AcftType);
|
||||||
|
|
||||||
int32_t Lat = DecodeLatitude();
|
int32_t Lat = DecodeLatitude();
|
||||||
|
|
Ładowanie…
Reference in New Issue