Better rendering when no fix is present

This commit is contained in:
Niccolò Izzo 2021-02-13 11:23:40 +01:00
parent 586b524625
commit a0814fd5d1
1 changed files with 61 additions and 51 deletions

View File

@ -240,12 +240,21 @@ void _ui_drawMenuGPS(ui_state_t* ui_state)
// Print "GPS" on top bar
gfx_print(layout.top_pos, "GPS", layout.top_font,
TEXT_ALIGN_CENTER, color_white);
// Print GPS status
// Print GPS status, if no fix, hide details
if (last_state.gps_data.fix_quality == 0)
{
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5};
gfx_print(fix_pos, "No Fix", layout.line3_font, TEXT_ALIGN_CENTER,
color_white);
} else if (last_state.gps_data.fix_quality == 6)
{
point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5};
gfx_print(fix_pos, "Fix Lost", layout.line3_font, TEXT_ALIGN_CENTER,
color_white);
} else
{
switch(last_state.gps_data.fix_quality)
{
case 0:
fix_buf = "No fix";
break;
case 1:
fix_buf = "SPS";
break;
@ -294,6 +303,7 @@ void _ui_drawMenuGPS(ui_state_t* ui_state)
last_state.gps_data.altitude);
gfx_print(layout.bottom_pos, data_buf, layout.bottom_font, TEXT_ALIGN_CENTER,
color_white);
}
// Draw compass
point_t compass_pos = {layout.horizontal_pad * 2, SCREEN_HEIGHT / 2};
gfx_drawGPScompass(compass_pos, SCREEN_WIDTH / 9, last_state.gps_data.satellites);