From ac8e7cf3d8d90196fc4990f452748180529eafbb Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 4 Jul 2023 15:09:26 +1000 Subject: [PATCH] Fix button not being released --- src/drivers/touchwheel.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp index 84d4d67c..2e44adfd 100644 --- a/src/drivers/touchwheel.cpp +++ b/src/drivers/touchwheel.cpp @@ -84,10 +84,10 @@ uint8_t TouchWheel::ReadRegister(uint8_t reg) { void TouchWheel::Update() { // Read data from device into member struct - bool has_data = !gpio_get_level(kIntPin); - if (!has_data) { - return; - } + // bool has_data = !gpio_get_level(kIntPin); + // if (!has_data) { + // return; + // } uint8_t status = ReadRegister(Register::DETECTION_STATUS); if (status & 0b10000000) { // Still calibrating. @@ -108,6 +108,9 @@ void TouchWheel::Update() { uint8_t reg = ReadRegister(Register::KEY_STATUS_A); data_.is_button_touched = reg & 0b1000; data_.is_wheel_touched = reg & 0b111; + } else { + data_.is_button_touched = false; + data_.is_wheel_touched = false; } }