From 96e74246bb885a8c486436480a3044827da38303 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 1 Oct 2024 14:59:53 +0200 Subject: [PATCH] Improve button input interactions --- RNode_Firmware.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index fa563c4..987a534 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -1379,9 +1379,7 @@ void sleep_now() { void button_event(uint8_t event, unsigned long duration) { #if MCU_VARIANT == MCU_ESP32 display_unblank(); - if (duration > 6000) { - bt_enable_pairing(); - } else if (duration > 4000) { + if (duration > 10000) { #if HAS_CONSOLE #if HAS_BLUETOOTH || HAS_BLE bt_stop(); @@ -1389,12 +1387,17 @@ void button_event(uint8_t event, unsigned long duration) { console_active = true; console_start(); #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 sleep_now(); #endif } else { #if HAS_BLUETOOTH || HAS_BLE + if (bt_state != BT_STATE_CONNECTED) { if (bt_state == BT_STATE_OFF) { bt_start(); bt_conf_save(true); @@ -1402,6 +1405,7 @@ void button_event(uint8_t event, unsigned long duration) { bt_stop(); bt_conf_save(false); } + } #endif } #endif