From b0c1315f61913707ed0bae9d0f34dce93bd49ec0 Mon Sep 17 00:00:00 2001 From: Cliff Date: Wed, 7 Sep 2022 04:39:00 -0700 Subject: [PATCH] fix(touch): Prevent multiple audio beeps (#2290) This actually probably an underlying issue in the driver, why it's sending two TE_DOWN events and causing multiple beeps However, this fix will hold until the touch driver interface is re-written --- radio/src/gui/colorlcd/LvglWrapper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/LvglWrapper.cpp b/radio/src/gui/colorlcd/LvglWrapper.cpp index 2471af36c..53cbb3fc9 100644 --- a/radio/src/gui/colorlcd/LvglWrapper.cpp +++ b/radio/src/gui/colorlcd/LvglWrapper.cpp @@ -219,9 +219,14 @@ extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data) copy_ts_to_indev_data(st, data); } + static bool onebeep=true; // TODO... This probably needs to be fixed in the driver it's sending two events if (st.event == TE_DOWN) { // on first touch (same logic as key down) reset_inactivity(); // reset activity counter - audioKeyPress(); // provide acoustic and/or haptic feedback if requested in settings + if(onebeep) + audioKeyPress(); // provide acoustic and/or haptic feedback if requested in settings + onebeep = false; + } else { + onebeep = true; } backup_touch_data(data);