From 4af6f7690e1bb803aae6692db556ae976eb734bc Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Tue, 17 Sep 2024 16:19:14 +0100 Subject: [PATCH] Add controlling Bluetooth with button --- Input.h | 2 ++ opencom_xl_firmware.ino | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Input.h b/Input.h index c9e6f03..86793da 100644 --- a/Input.h +++ b/Input.h @@ -20,6 +20,8 @@ #define RELEASED HIGH #define BUTTON_MIN_DURATION 50 + #define BUTTON_3S_DURATION 3000 + #define BUTTON_6S_DURATION 6000 #define EVENT_ALL 0x00 #define EVENT_CLICKS 0x01 diff --git a/opencom_xl_firmware.ino b/opencom_xl_firmware.ino index fb1efab..47fc5a1 100644 --- a/opencom_xl_firmware.ino +++ b/opencom_xl_firmware.ino @@ -1316,9 +1316,15 @@ void process_serial() { #if HAS_INPUT void button_event(uint8_t event, unsigned long duration) { if (duration > BUTTON_MIN_DURATION) { + if (duration > BUTTON_6S_DURATION) { + bt_stop(); + } else if (duration > BUTTON_3S_DURATION) { + bt_enable_pairing(); + } else { #if HAS_BUZZER_CTRL toggle_buzzer_enable(); #endif + } } } #endif