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++; + } + } }