diff --git a/src/Kaleidoscope/TapDance.cpp b/src/Kaleidoscope/TapDance.cpp index b9793bb3..157a5116 100644 --- a/src/Kaleidoscope/TapDance.cpp +++ b/src/Kaleidoscope/TapDance.cpp @@ -27,6 +27,7 @@ namespace KaleidoscopePlugins { uint8_t TapDance::tapCount[16]; uint16_t TapDance::pressedState; uint16_t TapDance::triggeredState; + uint16_t TapDance::releaseNextState; Key TapDance::lastTapDanceKey; byte TapDance::lastTapDanceRow; byte TapDance::lastTapDanceCol; @@ -72,14 +73,12 @@ namespace KaleidoscopePlugins { Key TapDance::release (uint8_t tapDanceIndex) { - tapDanceAction (tapDanceIndex, lastTapDanceRow, lastTapDanceCol, tapCount[tapDanceIndex], Release); - endTime = 0; - tapCount[tapDanceIndex] = 0; lastTapDanceKey.raw = Key_NoKey.raw; bitClear (pressedState, tapDanceIndex); bitClear (triggeredState, tapDanceIndex); + bitWrite (releaseNextState, tapDanceIndex, 1); return Key_NoKey; } @@ -208,6 +207,15 @@ namespace KaleidoscopePlugins { if (!postClear) return; + for (uint8_t i = 0; i < 16; i++) { + if (!bitRead (releaseNextState, i)) + continue; + + tapDanceAction (i, lastTapDanceRow, lastTapDanceCol, tapCount[i], Release); + tapCount[i] = 0; + bitClear (releaseNextState, i); + } + if (!isActive ()) return; diff --git a/src/Kaleidoscope/TapDance.h b/src/Kaleidoscope/TapDance.h index d545065d..e7545c4b 100644 --- a/src/Kaleidoscope/TapDance.h +++ b/src/Kaleidoscope/TapDance.h @@ -52,6 +52,7 @@ namespace KaleidoscopePlugins { static uint8_t tapCount[16]; static uint16_t pressedState; static uint16_t triggeredState; + static uint16_t releaseNextState; static Key lastTapDanceKey; static byte lastTapDanceRow; static byte lastTapDanceCol;