Add controlling Bluetooth with button

This commit is contained in:
jacob.eva 2024-09-17 16:19:14 +01:00
parent 49b7b13a36
commit 4af6f7690e
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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