diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 398e56097..440195a9f 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -253,12 +253,6 @@ static void onIdle() } } -static void screenPress() -{ - if (screen) - screen->onPress(); -} - static void bootEnter() { LOG_DEBUG("State: BOOT"); @@ -302,9 +296,9 @@ void PowerFSM_setup() powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press"); powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press"); powerFSM.add_transition(&stateDARK, isPowered() ? &statePOWER : &stateON, EVENT_PRESS, NULL, "Press"); - powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, screenPress, "Press"); - powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, screenPress, "Press"); // reenter On to restart our timers - powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, screenPress, + powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, NULL, "Press"); + powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, NULL, "Press"); // reenter On to restart our timers + powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, NULL, "Press"); // Allow button to work while in serial API // Handle critically low power battery by forcing deep sleep diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 21cf32283..6e4f3198b 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1814,10 +1814,25 @@ int Screen::handleInputEvent(const InputEvent *event) // If no modules are using the input, move between frames if (!inputIntercepted) { - if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) + if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) { showPrevFrame(); - else if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) + } else if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) { showNextFrame(); + } else if (event->inputEvent == + static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT)) { +#if HAS_TFT + if (this->ui->getUiState()->currentFrame == framesetInfo.positions.memory) { + showOverlayBanner("Switch to MUI?\nYES\nNO", 30000, 2, [](int selected) -> void { + if (selected == 0) { + config.display.displaymode = meshtastic_Config_DisplayConfig_DisplayMode_COLOR; + config.bluetooth.enabled = false; + service->reloadConfig(SEGMENT_CONFIG); + rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000); + } + }); + } +#endif + } } } diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 838ce993a..471442219 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -310,7 +310,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) if (isSelect) { // When inactive, call the onebutton shortpress instead. Activate module only on up/down powerFSM.trigger(EVENT_PRESS); - return 1; // Let caller know we handled it + return 0; // Main button press no longer runs through powerFSM } // Let LEFT/RIGHT pass through so frame navigation works if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT) || diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 1010e04c8..c83a3e72d 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -7,9 +7,8 @@ #define SENSOR_PORT_NUM 2 #define SENSOR_BAUD_RATE 115200 -#if !HAS_TFT #define BUTTON_PIN 38 -#endif + // #define BUTTON_NEED_PULLUP // #define BATTERY_PIN 27 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage