Add GPVTG sentence process
This commit is contained in:
parent
576c2af533
commit
09a18ba1a7
22
main.c
22
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue