mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-27 15:02:41 +00:00
Add WiFi/BT toggle for screenless devices
This commit is contained in:
parent
a2d86454d3
commit
e16fab8406
@ -18,6 +18,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
|
||||
|
||||
@ -1123,7 +1123,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;
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user