This commit is contained in:
Łukasz Kosson 2025-10-23 13:44:52 -04:00 committed by GitHub
commit 1fca9e5b8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View File

@ -20,6 +20,7 @@ enum input_broker_event {
INPUT_BROKER_ALT_LONG,
INPUT_BROKER_SHUTDOWN = 0x9b,
INPUT_BROKER_GPS_TOGGLE = 0x9e,
INPUT_BROKER_BT_WIFI_TOGGLE = 0x9f,
INPUT_BROKER_SEND_PING = 0xaf,
INPUT_BROKER_MATRIXKEY = 0xFE,
INPUT_BROKER_ANYKEY = 0xff

View File

@ -1116,7 +1116,7 @@ void setup()
mainDelay.interruptFromISR(&higherWake);
};
userConfigNoScreen.singlePress = INPUT_BROKER_USER_PRESS;
userConfigNoScreen.longPress = INPUT_BROKER_NONE;
userConfigNoScreen.longPress = INPUT_BROKER_BT_WIFI_TOGGLE;
userConfigNoScreen.longPressTime = 500;
userConfigNoScreen.longLongPress = INPUT_BROKER_SHUTDOWN;
userConfigNoScreen.doublePress = INPUT_BROKER_SEND_PING;

View File

@ -101,6 +101,22 @@ int SystemCommandsModule::handleInputEvent(const InputEvent *event)
}
#endif
return true;
case INPUT_BROKER_BT_WIFI_TOGGLE:
if (config.network.wifi_enabled)
{
LOG_WARN("Disabling WiFi, enabling BT");
config.network.wifi_enabled = false;
config.bluetooth.enabled = true;
}
else
{
LOG_WARN("Enabling WiFi, disabling BT");
config.network.wifi_enabled = true;
config.bluetooth.enabled = false;
}
nodeDB->saveToDisk();
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
return 0;
// Mesh ping
case INPUT_BROKER_SEND_PING:
service->refreshLocalMeshNode();