Display config added

This commit is contained in:
HarukiToreda
2025-12-15 02:47:09 -05:00
parent 5acf72243d
commit 83ec37113d
3 changed files with 27 additions and 4 deletions

View File

@@ -106,6 +106,7 @@ enum MenuAction {
TOGGLE_CHANNEL_DOWNLINK,
TOGGLE_CHANNEL_POSITION,
SET_CHANNEL_PRECISION,
TOGGLE_DISPLAY_UNITS,
};
} // namespace NicheGraphics::InkHUD

View File

@@ -392,6 +392,16 @@ void InkHUD::MenuApplet::execute(MenuItem item)
#endif
break;
// Display
case TOGGLE_DISPLAY_UNITS:
if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL)
config.display.units = meshtastic_Config_DisplayConfig_DisplayUnits_METRIC;
else
config.display.units = meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL;
nodeDB->saveToDisk(SEGMENT_CONFIG);
break;
// Bluetooth
case TOGGLE_BLUETOOTH:
config.bluetooth.enabled = !config.bluetooth.enabled;
@@ -752,12 +762,8 @@ void InkHUD::MenuApplet::showPage(MenuPage page)
&settings->optionalFeatures.notifications));
items.push_back(MenuItem("Battery Icon", MenuAction::TOGGLE_BATTERY_ICON, MenuPage::OPTIONS,
&settings->optionalFeatures.batteryIcon));
invertedColors = (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED);
items.push_back(MenuItem("Invert Color", MenuAction::TOGGLE_INVERT_COLOR, MenuPage::OPTIONS, &invertedColors));
items.push_back(
MenuItem("12-Hour Clock", MenuAction::TOGGLE_12H_CLOCK, MenuPage::OPTIONS, &config.display.use_12h_clock));
items.push_back(MenuItem("Exit", MenuPage::EXIT));
break;
@@ -790,6 +796,7 @@ void InkHUD::MenuApplet::showPage(MenuPage page)
#if defined(ARCH_ESP32)
items.push_back(MenuItem("Power", MenuPage::NODE_CONFIG_POWER));
#endif
items.push_back(MenuItem("Display", MenuPage::NODE_CONFIG_DISPLAY));
items.push_back(MenuItem("Bluetooth", MenuPage::NODE_CONFIG_BLUETOOTH));
items.push_back(MenuItem("Exit", MenuPage::EXIT));
break;
@@ -823,6 +830,20 @@ void InkHUD::MenuApplet::showPage(MenuPage page)
break;
}
#endif
case NODE_CONFIG_DISPLAY: {
items.push_back(MenuItem("Back", MenuAction::BACK, MenuPage::NODE_CONFIG));
items.push_back(MenuItem("12-Hour Clock", MenuAction::TOGGLE_12H_CLOCK, MenuPage::NODE_CONFIG_DISPLAY,
&config.display.use_12h_clock));
const char *unitsLabel =
(config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) ? "Units: Imperial" : "Units: Metric";
items.push_back(MenuItem(unitsLabel, MenuAction::TOGGLE_DISPLAY_UNITS, MenuPage::NODE_CONFIG_DISPLAY));
items.push_back(MenuItem("Exit", MenuPage::EXIT));
break;
}
case NODE_CONFIG_BLUETOOTH: {
items.push_back(MenuItem("Back", MenuAction::BACK, MenuPage::NODE_CONFIG));

View File

@@ -29,6 +29,7 @@ enum MenuPage : uint8_t {
NODE_CONFIG_DEVICE,
NODE_CONFIG_DEVICE_ROLE,
NODE_CONFIG_POWER,
NODE_CONFIG_DISPLAY,
NODE_CONFIG_BLUETOOTH,
TIMEZONE,
APPLETS,