Update Bluetooth Toggle to match other variants (#7269)

This commit is contained in:
Jason P 2025-07-08 13:38:07 -05:00 committed by GitHub
parent db4e4e6e53
commit 916587c2a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 3 deletions

View File

@ -337,8 +337,8 @@ void menuHandler::homeBaseMenu()
} else if (selected == Freetext) { } else if (selected == Freetext) {
cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST); cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST);
} else if (selected == Bluetooth) { } else if (selected == Bluetooth) {
InputEvent event = {.inputEvent = (input_broker_event)170, .kbchar = 170, .touchX = 0, .touchY = 0}; menuQueue = bluetooth_toggle_menu;
inputBroker->injectInputEvent(&event); screen->runNow();
} }
}; };
screen->showOverlayBanner(bannerOptions); screen->showOverlayBanner(bannerOptions);
@ -587,6 +587,23 @@ void menuHandler::GPSToggleMenu()
} }
#endif #endif
void menuHandler::BluetoothToggleMenu()
{
static const char *optionsArray[] = {"Back", "Enabled", "Disabled"};
BannerOverlayOptions bannerOptions;
bannerOptions.message = "Toggle Bluetooth";
bannerOptions.optionsArrayPtr = optionsArray;
bannerOptions.optionsCount = 3;
bannerOptions.bannerCallback = [](int selected) -> void {
if (selected == 1 || selected == 2) {
InputEvent event = {.inputEvent = (input_broker_event)170, .kbchar = 170, .touchX = 0, .touchY = 0};
inputBroker->injectInputEvent(&event);
}
};
bannerOptions.InitialSelected = config.bluetooth.enabled ? 1 : 2;
screen->showOverlayBanner(bannerOptions);
}
void menuHandler::BuzzerModeMenu() void menuHandler::BuzzerModeMenu()
{ {
static const char *optionsArray[] = {"All Enabled", "Disabled", "Notifications", "System Only"}; static const char *optionsArray[] = {"All Enabled", "Disabled", "Notifications", "System Only"};
@ -935,6 +952,9 @@ void menuHandler::handleMenuSwitch(OLEDDisplay *display)
case wifi_toggle_menu: case wifi_toggle_menu:
wifiToggleMenu(); wifiToggleMenu();
break; break;
case bluetooth_toggle_menu:
BluetoothToggleMenu();
break;
} }
menuQueue = menu_none; menuQueue = menu_none;
} }

View File

@ -25,7 +25,8 @@ class menuHandler
remove_favorite, remove_favorite,
test_menu, test_menu,
number_test, number_test,
wifi_toggle_menu wifi_toggle_menu,
bluetooth_toggle_menu
}; };
static screenMenus menuQueue; static screenMenus menuQueue;
@ -55,6 +56,7 @@ class menuHandler
static void numberTest(); static void numberTest();
static void wifiBaseMenu(); static void wifiBaseMenu();
static void wifiToggleMenu(); static void wifiToggleMenu();
static void BluetoothToggleMenu();
}; };
} // namespace graphics } // namespace graphics