diff options
-rw-r--r-- | utils/loc_nmea.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp index 24197ff..61db2be 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -1439,8 +1439,19 @@ void loc_nmea_generate_pos(const UlpLocation &location, pMarker = sentence_RMC; lengthRemaining = sizeof(sentence_RMC); - length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A," , - talker, utcHours, utcMinutes, utcSeconds,utcMSeconds/10); + bool validFix = ((0 != sv_cache_info.gps_used_mask) || + (0 != sv_cache_info.glo_used_mask) || + (0 != sv_cache_info.gal_used_mask) || + (0 != sv_cache_info.qzss_used_mask) || + (0 != sv_cache_info.bds_used_mask)); + + if (validFix) { + length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A,", + talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10); + } else { + length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,V,", + talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10); + } if (length < 0 || length >= lengthRemaining) { @@ -1581,8 +1592,6 @@ void loc_nmea_generate_pos(const UlpLocation &location, // hardcode Navigation Status field to 'V' length = snprintf(pMarker, lengthRemaining, ",%c", 'V'); - pMarker += length; - lengthRemaining -= length; length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC)); |