Improve button input interactions

This commit is contained in:
Mark Qvist 2024-10-01 14:59:53 +02:00
parent e5028c88d6
commit 96e74246bb

View File

@ -1379,9 +1379,7 @@ void sleep_now() {
void button_event(uint8_t event, unsigned long duration) { void button_event(uint8_t event, unsigned long duration) {
#if MCU_VARIANT == MCU_ESP32 #if MCU_VARIANT == MCU_ESP32
display_unblank(); display_unblank();
if (duration > 6000) { if (duration > 10000) {
bt_enable_pairing();
} else if (duration > 4000) {
#if HAS_CONSOLE #if HAS_CONSOLE
#if HAS_BLUETOOTH || HAS_BLE #if HAS_BLUETOOTH || HAS_BLE
bt_stop(); bt_stop();
@ -1389,12 +1387,17 @@ void button_event(uint8_t event, unsigned long duration) {
console_active = true; console_active = true;
console_start(); console_start();
#endif #endif
} else if (duration > 2000) { } else if (duration > 5000) {
#if HAS_BLUETOOTH || HAS_BLE
if (bt_state != BT_STATE_CONNECTED) { bt_enable_pairing(); }
#endif
} else if (duration > 700) {
#if HAS_SLEEP #if HAS_SLEEP
sleep_now(); sleep_now();
#endif #endif
} else { } else {
#if HAS_BLUETOOTH || HAS_BLE #if HAS_BLUETOOTH || HAS_BLE
if (bt_state != BT_STATE_CONNECTED) {
if (bt_state == BT_STATE_OFF) { if (bt_state == BT_STATE_OFF) {
bt_start(); bt_start();
bt_conf_save(true); bt_conf_save(true);
@ -1402,6 +1405,7 @@ void button_event(uint8_t event, unsigned long duration) {
bt_stop(); bt_stop();
bt_conf_save(false); bt_conf_save(false);
} }
}
#endif #endif
} }
#endif #endif