core: gps: add enums for GPS fix quality and type

Signed-off-by: Silvano Seva <silseva@fastwebnet.it>
This commit is contained in:
Silvano Seva 2025-10-01 21:11:28 +02:00
parent 809f54cb1b
commit f2f84f3da1
2 changed files with 37 additions and 9 deletions

View File

@ -24,6 +24,30 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
/**
* Enumeration type for GPS fix quality, according to the quality
* indicator field of NMEA GGA sentence
*/
enum FixQuality {
FIX_QUALITY_NO_FIX = 0,
FIX_QUALITY_GPS,
FIX_QUALITY_DGPS,
FIX_QUALITY_PPS,
FIX_QUALITY_RTK,
FIX_QUALITY_RTK_FLOAT,
FIX_QUALITY_ESTIMATED,
};
/**
* Enumeration type for GPS fix type, according to the fix type field of
* NMEA GSA sentence
*/
enum FixType {
FIX_TYPE_NOT_AVAIL = 1,
FIX_TYPE_2D,
FIX_TYPE_3D,
};
/** /**
* Data structure representing a single satellite as part of a GPS fix. * Data structure representing a single satellite as part of a GPS fix.
*/ */

View File

@ -684,25 +684,29 @@ void _ui_drawMenuGPS()
else if(!last_state.settings.gps_enabled) else if(!last_state.settings.gps_enabled)
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->gpsOff); color_white, currentLanguage->gpsOff);
else if (last_state.gps_data.fix_quality == 0) else if (last_state.gps_data.fix_quality == FIX_QUALITY_NO_FIX)
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->noFix); color_white, currentLanguage->noFix);
else if (last_state.gps_data.fix_quality == 6) else if (last_state.gps_data.fix_quality == FIX_QUALITY_ESTIMATED)
gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER,
color_white, currentLanguage->fixLost); color_white, currentLanguage->fixLost);
else else
{ {
switch(last_state.gps_data.fix_quality) switch(last_state.gps_data.fix_quality)
{ {
case 1: case FIX_QUALITY_GPS:
fix_buf = "SPS"; fix_buf = "GPS";
break; break;
case 2: case FIX_QUALITY_DGPS:
fix_buf = "DGPS"; fix_buf = "DGPS";
break; break;
case 3: case FIX_QUALITY_PPS:
fix_buf = "PPS"; fix_buf = "PPS";
break; break;
case FIX_QUALITY_RTK:
case FIX_QUALITY_RTK_FLOAT:
fix_buf = "RTK";
break;
default: default:
fix_buf = (char*)currentLanguage->error; fix_buf = (char*)currentLanguage->error;
break; break;
@ -710,13 +714,13 @@ void _ui_drawMenuGPS()
switch(last_state.gps_data.fix_type) switch(last_state.gps_data.fix_type)
{ {
case 1: case FIX_TYPE_NOT_AVAIL:
type_buf = ""; type_buf = "";
break; break;
case 2: case FIX_TYPE_2D:
type_buf = "2D"; type_buf = "2D";
break; break;
case 3: case FIX_TYPE_3D:
type_buf = "3D"; type_buf = "3D";
break; break;
default: default: