kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Add NL after the B-record
rodzic
077688b9e6
commit
b3ff988835
|
@ -288,22 +288,23 @@ int APRS2IGC(char *Out, const char *Inp, int GeoidSepar) // convert
|
||||||
memcpy(Out+Len, Pos+15,2); Len+=2; // copy fractional MM
|
memcpy(Out+Len, Pos+15,2); Len+=2; // copy fractional MM
|
||||||
Out[Len++] = ExtPos?ExtPos[1]:'0'; // extended precision
|
Out[Len++] = ExtPos?ExtPos[1]:'0'; // extended precision
|
||||||
Out[Len++] = Pos[17]; // copy E/W sign
|
Out[Len++] = Pos[17]; // copy E/W sign
|
||||||
Out[Len++] = 'A';
|
Out[Len++] = 'A'; // GPS-valid flag
|
||||||
memcpy(Out+Len, " ", 10);
|
memcpy(Out+Len, " ", 10); // prefill pressure and GNSS altitude with spaces
|
||||||
const char *FL = strstr(Pos+18, " FL");
|
const char *FL = strstr(Pos+18, " FL"); // search pressure altitude
|
||||||
int32_t AltH=0; int32_t AltL=0;
|
int32_t AltH=0; int32_t AltL=0;
|
||||||
if(FL && FL[6]=='.' && Read_Int(AltH, FL+3)==3 && Read_Int(AltL, FL+7)==2) // pressure altitude
|
if(FL && FL[6]=='.' && Read_Int(AltH, FL+3)==3 && Read_Int(AltL, FL+7)==2) // pressure altitude
|
||||||
{ int Alt = AltH*100+AltL; Alt=FeetToMeters(Alt);
|
{ int Alt = AltH*100+AltL; Alt=FeetToMeters(Alt);
|
||||||
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
||||||
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
||||||
}
|
}
|
||||||
Len+=5; int32_t Alt=0;
|
Len+=5;
|
||||||
|
int32_t Alt=0; //
|
||||||
if(Pos[27]=='A' && Pos[28]=='=' && Read_Int(Alt, Pos+29)==6) // geometrical altitude
|
if(Pos[27]=='A' && Pos[28]=='=' && Read_Int(Alt, Pos+29)==6) // geometrical altitude
|
||||||
{ Alt=FeetToMeters(Alt); Alt+=GeoidSepar; // convert to meters and add GeoidSepar for HAE
|
{ Alt=FeetToMeters(Alt); Alt+=GeoidSepar; // convert to meters and add GeoidSepar for HAE
|
||||||
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
||||||
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
||||||
}
|
}
|
||||||
Len+=5;
|
Len+=5;
|
||||||
Out[Len]=0; return Len; }
|
Out[Len++]='\n'; Out[Len]=0; return Len; } // add NL, terminator and return length og the string
|
||||||
|
|
||||||
// ==============================================================================================
|
// ==============================================================================================
|
||||||
|
|
|
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||||
OutFile=fopen(OutFileName, "wt");
|
OutFile=fopen(OutFileName, "wt");
|
||||||
if(OutFile==0) { printf("Cannot open %s for write\n", OutFileName); return 0; }
|
if(OutFile==0) { printf("Cannot open %s for write\n", OutFileName); return 0; }
|
||||||
for(size_t Idx=0; Idx<OutLine.size(); Idx++)
|
for(size_t Idx=0; Idx<OutLine.size(); Idx++)
|
||||||
{ fprintf(OutFile, "%s\n", OutLine[Idx]); }
|
{ fprintf(OutFile, "%s", OutLine[Idx]); }
|
||||||
fclose(OutFile);
|
fclose(OutFile);
|
||||||
printf("%lu lines to %s\n", OutLine.size(), OutFileName);
|
printf("%lu lines to %s\n", OutLine.size(), OutFileName);
|
||||||
|
|
||||||
|
|
|
@ -288,22 +288,23 @@ int APRS2IGC(char *Out, const char *Inp, int GeoidSepar) // convert
|
||||||
memcpy(Out+Len, Pos+15,2); Len+=2; // copy fractional MM
|
memcpy(Out+Len, Pos+15,2); Len+=2; // copy fractional MM
|
||||||
Out[Len++] = ExtPos?ExtPos[1]:'0'; // extended precision
|
Out[Len++] = ExtPos?ExtPos[1]:'0'; // extended precision
|
||||||
Out[Len++] = Pos[17]; // copy E/W sign
|
Out[Len++] = Pos[17]; // copy E/W sign
|
||||||
Out[Len++] = 'A';
|
Out[Len++] = 'A'; // GPS-valid flag
|
||||||
memcpy(Out+Len, " ", 10);
|
memcpy(Out+Len, " ", 10); // prefill pressure and GNSS altitude with spaces
|
||||||
const char *FL = strstr(Pos+18, " FL");
|
const char *FL = strstr(Pos+18, " FL"); // search pressure altitude
|
||||||
int32_t AltH=0; int32_t AltL=0;
|
int32_t AltH=0; int32_t AltL=0;
|
||||||
if(FL && FL[6]=='.' && Read_Int(AltH, FL+3)==3 && Read_Int(AltL, FL+7)==2) // pressure altitude
|
if(FL && FL[6]=='.' && Read_Int(AltH, FL+3)==3 && Read_Int(AltL, FL+7)==2) // pressure altitude
|
||||||
{ int Alt = AltH*100+AltL; Alt=FeetToMeters(Alt);
|
{ int Alt = AltH*100+AltL; Alt=FeetToMeters(Alt);
|
||||||
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
||||||
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
||||||
}
|
}
|
||||||
Len+=5; int32_t Alt=0;
|
Len+=5;
|
||||||
|
int32_t Alt=0; //
|
||||||
if(Pos[27]=='A' && Pos[28]=='=' && Read_Int(Alt, Pos+29)==6) // geometrical altitude
|
if(Pos[27]=='A' && Pos[28]=='=' && Read_Int(Alt, Pos+29)==6) // geometrical altitude
|
||||||
{ Alt=FeetToMeters(Alt); Alt+=GeoidSepar; // convert to meters and add GeoidSepar for HAE
|
{ Alt=FeetToMeters(Alt); Alt+=GeoidSepar; // convert to meters and add GeoidSepar for HAE
|
||||||
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
if(Alt<0) { Alt = (-Alt); Out[Len] = '-'; Format_UnsDec(Out+Len+1, (uint32_t)Alt, 4); }
|
||||||
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
else { Format_UnsDec(Out+Len, (uint32_t)Alt, 5); }
|
||||||
}
|
}
|
||||||
Len+=5;
|
Len+=5;
|
||||||
Out[Len]=0; return Len; }
|
Out[Len++]='\n'; Out[Len]=0; return Len; } // add NL, terminator and return length og the string
|
||||||
|
|
||||||
// ==============================================================================================
|
// ==============================================================================================
|
||||||
|
|
Ładowanie…
Reference in New Issue