diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h index 9cc4b6640..0b3a88097 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -107,6 +107,7 @@ enum MenuAction { TOGGLE_CHANNEL_POSITION, SET_CHANNEL_PRECISION, TOGGLE_DISPLAY_UNITS, + TOGGLE_WIFI, }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index 6cd282aa3..73b939d21 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -379,19 +379,31 @@ void InkHUD::MenuApplet::execute(MenuItem item) LOG_INFO("Enabling Bluetooth"); config.network.wifi_enabled = false; config.bluetooth.enabled = true; - nodeDB->saveToDisk(); + nodeDB->saveToDisk(SEGMENT_CONFIG); rebootAtMsec = millis() + 2000; break; - // Power - case TOGGLE_POWER_SAVE: + // Power / Network (ESP32-only) #if defined(ARCH_ESP32) + case TOGGLE_POWER_SAVE: config.power.is_power_saving = !config.power.is_power_saving; nodeDB->saveToDisk(SEGMENT_CONFIG); rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; -#endif break; + case TOGGLE_WIFI: + config.network.wifi_enabled = !config.network.wifi_enabled; + + if (config.network.wifi_enabled) { + // Switch behavior: WiFi ON forces Bluetooth OFF + config.bluetooth.enabled = false; + } + + nodeDB->saveToDisk(SEGMENT_CONFIG); + rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; + break; +#endif + // Display case TOGGLE_DISPLAY_UNITS: if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) @@ -405,6 +417,12 @@ void InkHUD::MenuApplet::execute(MenuItem item) // Bluetooth case TOGGLE_BLUETOOTH: config.bluetooth.enabled = !config.bluetooth.enabled; + + if (config.bluetooth.enabled) { + // Switch behavior: Bluetooth ON forces WiFi OFF + config.network.wifi_enabled = false; + } + nodeDB->saveToDisk(SEGMENT_CONFIG); rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; break; @@ -791,7 +809,9 @@ void InkHUD::MenuApplet::showPage(MenuPage page) #if defined(ARCH_ESP32) items.push_back(MenuItem("Power", MenuPage::NODE_CONFIG_POWER)); + items.push_back(MenuItem("Network", MenuPage::NODE_CONFIG_NETWORK)); #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)); @@ -840,6 +860,17 @@ void InkHUD::MenuApplet::showPage(MenuPage page) items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; } + + case NODE_CONFIG_NETWORK: { + items.push_back(MenuItem("Back", MenuAction::BACK, MenuPage::NODE_CONFIG)); + + const char *wifiLabel = config.network.wifi_enabled ? "WiFi: On" : "WiFi: Off"; + + items.push_back(MenuItem(wifiLabel, MenuAction::TOGGLE_WIFI, MenuPage::EXIT)); + + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + } #endif case NODE_CONFIG_DISPLAY: { items.push_back(MenuItem("Back", MenuAction::BACK, MenuPage::NODE_CONFIG)); diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h index da31a9b79..b836dfa35 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h @@ -29,8 +29,10 @@ enum MenuPage : uint8_t { NODE_CONFIG_DEVICE, NODE_CONFIG_DEVICE_ROLE, NODE_CONFIG_POWER, + NODE_CONFIG_NETWORK, NODE_CONFIG_DISPLAY, NODE_CONFIG_BLUETOOTH, + NODE_CONFIG_POSITION, TIMEZONE, APPLETS, AUTOSHOW,