kopia lustrzana https://github.com/ogre/pizero_tracker
nmea_t::utc is now char[6]
rodzic
d94b597e4a
commit
5df5b32881
|
@ -56,8 +56,8 @@ std::string CRC(std::string i_str)
|
|||
|
||||
void CTRL_C(int sig)
|
||||
{
|
||||
close(radio_fd);
|
||||
gpioWrite(GPIOPIN_MTX2_EN_gpio, 0);
|
||||
close(radio_fd);
|
||||
gpioTerminate();
|
||||
exit(0);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ int main1()
|
|||
// msg_stream<<nmea;
|
||||
msg_stream<<"not-a-real-flight";
|
||||
msg_stream<<","<<msg_num;
|
||||
msg_stream<<",123456";
|
||||
msg_stream<<","<<nmea.utc;
|
||||
msg_stream<<","<<nmea.lat<<","<<nmea.lon<<","<<nmea.alt;
|
||||
// msg_stream<<","<<"05231.4567"<<","<<"2117.8412"<<","<<nmea.alt; // example NMEA format
|
||||
msg_stream<<","<<setprecision(1)<<fixed<<temperature_cels;
|
||||
|
@ -168,6 +168,7 @@ int main1()
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return main1();
|
||||
|
|
|
@ -101,7 +101,7 @@ bool NMEA_parse(const char* Buffer, nmea_t& o_nmea)
|
|||
|
||||
// cout << "??? " << Buffer << endl;
|
||||
|
||||
float utc = 0;
|
||||
int utc = 0;
|
||||
int date = 0;
|
||||
|
||||
float lat = 0;
|
||||
|
@ -136,7 +136,7 @@ bool NMEA_parse(const char* Buffer, nmea_t& o_nmea)
|
|||
if (strncmp(Buffer + 3, "GGA", 3) == 0) // Global positioning system fix data
|
||||
{
|
||||
int scanned_positions =
|
||||
sscanf(Buffer + 7, "%f,%f,%c,%f,%c,%d,%d,%f,%f,%c", &
|
||||
sscanf(Buffer + 7, "%d,%f,%c,%f,%c,%d,%d,%f,%f,%c", &
|
||||
utc, &lat, &ns, &lon, &ew, &quality, &sats, &hdop, &alt, &alt_units);
|
||||
if(scanned_positions == 10)
|
||||
{
|
||||
|
@ -148,8 +148,7 @@ bool NMEA_parse(const char* Buffer, nmea_t& o_nmea)
|
|||
if(ew == 'W')
|
||||
lon = -lon;
|
||||
|
||||
|
||||
o_nmea.utc = utc;
|
||||
sprintf(o_nmea.utc, "%06d", utc);
|
||||
o_nmea.lat = lat;
|
||||
o_nmea.lon = lon;
|
||||
o_nmea.alt = alt;
|
||||
|
@ -205,7 +204,7 @@ bool NMEA_parse(const char* Buffer, nmea_t& o_nmea)
|
|||
if(ew == 'W')
|
||||
lon = -lon;
|
||||
|
||||
o_nmea.utc = utc;
|
||||
sprintf(o_nmea.utc, "%06d", utc);
|
||||
o_nmea.lat = lat;
|
||||
o_nmea.lon = lon;
|
||||
o_nmea.alt = alt;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
class nmea_t
|
||||
{
|
||||
public:
|
||||
int utc = 0;
|
||||
char utc[6] = {'0', '0', '0', '0', '0', '0'}; // HHMMSS
|
||||
|
||||
float lat = 0; // degree
|
||||
float lon = 0; // degree
|
||||
|
|
Ładowanie…
Reference in New Issue