Hello, I use tinygps++ with a NEO-6M to build on SDcard an IGC file (my objective is to build my own variometer for paragliding).
The file is well created and seem to be recognized correctly by different softwares. The problem is they are putting my GPS plots at around 80km from where I'm.. !!??
The IGC spec files indicates:
Longitude 9 bytes DDDMMmmmE/W Valid characters E,W, 0-9. Obtained directly from the same GPS data package that was the source of UTC time that is recorded in the same B-record line. If no longitude is obtained from satellite data, pressure altitude fixing must continue, using times from the RTC. In this case, in B record lines must repeat the last longitude that was obtained from satellite data, until GPS fixing is regained
In order to get the longitude I use this code :
///////////////////////////Handle longitude/////////////////////////////
Long = (gps.location.lng() * 1000000); //remove decimal point from float
if (Long >= 0) { //if EAST
if (Long < 1000000) { //if less than 1 degrees
IGCdata += "000";
IGCdata += Long;
}
else if (Long >= 1000000 && Long < 10000000) { //more or equal 1 & less 10
IGCdata += "00";
IGCdata += Long;
}
else if (Long >= 10000000 && Long < 100000000) { //more or equal 10 & less 100
IGCdata += "00";
IGCdata += Long;
}
else { // if more than 99 degrees
IGCdata += Long;
}
IGCdata += "E";
}
else { //if WEST
if (Long > -1000000) { //if more than -1 degrees
IGCdata += "000";
IGCdata += Long;
IGCdata.remove(18, 1);
IGCdata.remove(23, 1); // due to third 0, the long is too long
}
else if (Long <= -1000000 && Long > -10000000) { //if more than -10 degrees & less than -1
IGCdata += "00";
IGCdata += Long;
IGCdata.remove(17, 1);
}
else if (Long <= -10000000 && Long > -100000000) { //if more than -100 degrees & less than -10
IGCdata += "0";
IGCdata += Long;
IGCdata.remove(16, 1);
}
else { // if less than -99 degrees
IGCdata += Long;
IGCdata.remove(15, 1);
}
IGCdata += "W";
}
The IGC file output:
AXXXVARIO-ARR
HFDTE190324
HFFXA010
HFPLTPILOTINCHARGE:-PilotName-
HFCM2CREW2:none
HFGTYGLIDERTYPE:Paraglide
HFGIDGLIDERID:00
HFDTM100GPSDATUM:WGS-1984
HFRFWFIRMWAREVERSION:0.1
HFRHWHARDWAREVERSION:0.1
HFFTYFRTYPE:VARIO-ARR v1.O
HFGPSNeo6m,v1.0,12ch,10000m
HFPRSPRESSALTSENSOR: bme280
B1633054576282N00074313WA0001100000
I don't get where is my error. Do you have some idears?
Guillaume