Add M17 Settings

This commit is contained in:
Federico Amedeo Izzo 2021-05-10 22:20:10 +02:00 committed by Silvano Seva
parent 882a657359
commit 87703a76e6
4 changed files with 35 additions and 2 deletions

View File

@ -31,6 +31,7 @@ typedef struct
int8_t utc_timezone;
bool gps_enabled;
bool gps_set_time;
char callsign[10]; // Plaintext callsign, used for M17
}
__attribute__((packed)) settings_t;
@ -46,7 +47,8 @@ static const settings_t default_settings =
#endif
0, // UTC Timezone
false, // GPS enabled
true // GPS set time
true, // GPS set time
"" // Empty callsign
};
#endif /* SETTINGS_H */

View File

@ -54,6 +54,7 @@ enum uiScreen
SETTINGS_TIMEDATE_SET,
SETTINGS_DISPLAY,
SETTINGS_GPS,
SETTINGS_M17,
LOW_BAT
};
@ -87,6 +88,7 @@ enum settingsItems
#ifdef HAS_GPS
,S_GPS
#endif
,S_M17
};
enum displayItems

View File

@ -104,6 +104,7 @@ extern void _ui_drawSettingsTimeDate();
extern void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state);
#endif
extern void _ui_drawSettingsDisplay(ui_state_t* ui_state);
extern void _ui_drawSettingsM17();
extern bool _ui_drawMacroMenu();
const char *menu_items[] =
@ -126,8 +127,9 @@ const char *settings_items[] =
"Time & Date",
#endif
#ifdef HAS_GPS
"GPS"
"GPS",
#endif
"M17"
};
const char *display_items[] =
@ -1053,6 +1055,9 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
state.ui_screen = SETTINGS_GPS;
break;
#endif
case S_M17:
state.ui_screen = SETTINGS_M17;
break;
default:
state.ui_screen = MENU_SETTINGS;
}
@ -1209,6 +1214,11 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
_ui_menuBack(MENU_SETTINGS);
break;
#endif
// M17 Settings
case SETTINGS_M17:
if(msg.keys & KEY_ESC)
_ui_menuBack(MENU_SETTINGS);
break;
}
}
}
@ -1297,6 +1307,10 @@ void ui_updateGUI()
_ui_drawSettingsGPS(&ui_state);
break;
#endif
// M17 settings screen
case SETTINGS_M17:
_ui_drawSettingsM17();
break;
// Low battery screen
case LOW_BAT:
_ui_drawLowBatteryScreen();

View File

@ -513,6 +513,21 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
}
#endif
void _ui_drawSettingsM17()
{
gfx_clearScreen();
// Print "M17 Settings" on top bar
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "M17 Settings");
gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.menu_font,
TEXT_ALIGN_LEFT, color_white, "Callsign:");
// Print M17 current callsign
gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
layout.horizontal_pad, layout.input_font,
TEXT_ALIGN_CENTER, color_white, last_state.settings.callsign);
}
bool _ui_drawMacroMenu() {
// Header
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,