Add GPVTG sentence process

This commit is contained in:
Sanyog Nevase Nevase 2024-11-30 03:08:33 +05:30
parent 576c2af533
commit 09a18ba1a7
1 changed files with 22 additions and 0 deletions

22
main.c
View File

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