From 2cb15f3a4951df3852e66ed0b2a69ae6b218a3d5 Mon Sep 17 00:00:00 2001 From: Mike Park Date: Sun, 20 Dec 2020 18:07:42 -0800 Subject: [PATCH] Fix for two finger presses not working on 16k. Before, if a key was already being pressed, it would not check for increased pressure to go from single to double press. Now if the key is currently single pressed, it checks if the threshold for double press has been passed. The delta threshold for 16k has also been increased, as the previous one was too low and was giving double press even for only one finger. --- Firmware/OpeNITHM/AutoTouchboard.cpp | 13 +++++++++++-- Firmware/OpeNITHM/AutoTouchboard.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Firmware/OpeNITHM/AutoTouchboard.cpp b/Firmware/OpeNITHM/AutoTouchboard.cpp index acb6e76..871cea5 100644 --- a/Firmware/OpeNITHM/AutoTouchboard.cpp +++ b/Firmware/OpeNITHM/AutoTouchboard.cpp @@ -97,10 +97,19 @@ KeyState AutoTouchboard::update(int key) { } else if (pressure > triggerThresholdsSingle[key]) { states[key] = SINGLE_PRESS; } - // new release detected - } else if (states[key] != UNPRESSED) { + } else if (states[key] == SINGLE_PRESS) { + // going from single -> double + if (pressure > triggerThresholdsDouble[key]) { + states[key] = DOUBLE_PRESS; + // releasing single + } else if (pressure < releaseThresholdsSingle[key]) { + states[key] = UNPRESSED; + } + } else if (states[key] == DOUBLE_PRESS) { + // releasing completely if (pressure < releaseThresholdsSingle[key]) { states[key] = UNPRESSED; + // going from double -> single } else if (pressure < releaseThresholdsDouble[key]) { states[key] = SINGLE_PRESS; } diff --git a/Firmware/OpeNITHM/AutoTouchboard.h b/Firmware/OpeNITHM/AutoTouchboard.h index 004a4bb..a1bb3e8 100644 --- a/Firmware/OpeNITHM/AutoTouchboard.h +++ b/Firmware/OpeNITHM/AutoTouchboard.h @@ -32,7 +32,7 @@ class AutoTouchboard { int deltaThreshold = 5; double releaseThreshold = 0.8; #else - int deltaThreshold = 6; + int deltaThreshold = 15; double releaseThreshold = 0.8; #endif