From 09a18ba1a71322c58544157fee6aa1333e3ef909 Mon Sep 17 00:00:00 2001 From: Sanyog Date: Sat, 30 Nov 2024 03:08:33 +0530 Subject: [PATCH] Add GPVTG sentence process --- main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/main.c b/main.c index 440ff78..3ae1410 100644 --- a/main.c +++ b/main.c @@ -104,6 +104,28 @@ void nmea_sentence_process(const char *nmea_sentence) } } } + else if (strncmp(nmea_sentence + 1, "GPVTG", 5) == 0) // Process GPVTG sentence + { + for (i = 7; nmea_sentence[i] != '\0'; i++) + { + if (nmea_sentence[i] == ',') + { + if (field_number == 6) + { + speed_kmh = atof(nmea_sentence + i - field_index); + control_leds_based_on_speed(speed_kmh); + } + field_number++; + field_index = 0; + } + else if (nmea_sentence[i] == '*') + { + break; + } + else { + field_index++; + } + } }