diff --git a/main/gps.cpp b/main/gps.cpp index a3c4001..ee3522a 100644 --- a/main/gps.cpp +++ b/main/gps.cpp @@ -109,10 +109,11 @@ FlightMonitor Flight; // ---------------------------------------------------------------------------- -static char GPS_Cmd[64]; +static char GPS_Cmd[64]; // command to be send to the GPS -static uint16_t SatSNRsum = 0; // sum up the satellite SNR's -static uint8_t SatSNRcount = 0; // sum counter +// Satellite count and SNR per system, 0=GPS, 1=GLONASS, 2=GALILEO, 3=BEIDO +static uint16_t SatSNRsum[4] = { 0, 0, 0, 0 }; // sum up the satellite SNR's +static uint8_t SatSNRcount[4] = { 0, 0, 0, 0 }; // sum counter struct GPS_Sat // store GPS satellite data in single 32-bit word { union @@ -136,33 +137,43 @@ static void ProcessGSV(NMEA_RxMsg &GSV) // process GxGSV to extract Format_String(CONS_UART_Write, ")\n"); xSemaphoreGive(CONS_Mutex); #endif - if(!GSV.isGPGSV()) return; // for now, only the GPS satellites, before we learn to mix the others in + uint8_t SatSys=0; + if(GSV.isGPGSV()) { SatSys=0; } + else if(GSV.isGLGSV()) { SatSys=1; } + else if(GSV.isGAGSV()) { SatSys=2; } + else return; if(GSV.Parms<3) return; - int8_t Pkts=Read_Dec1((const char *)GSV.ParmPtr(0)); if(Pkts<0) return; - int8_t Pkt =Read_Dec1((const char *)GSV.ParmPtr(1)); if(Pkt <0) return; - int8_t Sats=Read_Dec2((const char *)GSV.ParmPtr(2)); // - if(Sats<0) Sats=Read_Dec1((const char *)GSV.ParmPtr(2)); // + int8_t Pkts=Read_Dec1((const char *)GSV.ParmPtr(0)); if(Pkts<0) return; // how many packets to pass all sats + int8_t Pkt =Read_Dec1((const char *)GSV.ParmPtr(1)); if(Pkt <0) return; // which packet in the sequence + int8_t Sats=Read_Dec2((const char *)GSV.ParmPtr(2)); // total number of satellites + if(Sats<0) Sats=Read_Dec1((const char *)GSV.ParmPtr(2)); // could be a single or double digit number if(Sats<0) return; - for( int Parm=3; Parm