Skip to content

Commit b36568d

Browse files
authored
Merge pull request #51 from aarongeorge/main
Fix debouncing typo
2 parents 3795348 + d81f15d commit b36568d

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

Applications/Python/PikaPython/MatrixOS_KeyState.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class KeyState:
99
HOLD: int = 3
1010
AFTERTOUCH: int = 4
1111
RELEASED: int = 5
12-
DEBUNCING: int = 240
13-
RELEASE_DEBUNCING: int = 241
14-
INVALID: int = 255
12+
DEBOUNCING: int = 240
13+
RELEASE_DEBOUNCING: int = 241
14+
INVALID: int = 255

OS/Framework/KeyEvent/KeyInfo.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inline uint16_t MAX(uint16_t a, uint16_t b) {
1313
// Constructor is defined in the header file
1414

1515
bool KeyInfo::Active() {
16-
return (state >= ACTIVATED && state <= AFTERTOUCH) || state == RELEASE_DEBUNCING;
16+
return (state >= ACTIVATED && state <= AFTERTOUCH) || state == RELEASE_DEBOUNCING;
1717
}
1818

1919
KeyInfo::operator bool() {
@@ -80,8 +80,8 @@ IRAM_ATTR bool KeyInfo::Update(KeyConfig& config, Fract16 new_value) {
8080
{
8181
if(config.debounce > 0)
8282
{
83-
// MatrixOS::Logging::LogVerbose("KeyInfo", "IDLE -> DEBUNCING");
84-
state = DEBUNCING;
83+
// MatrixOS::Logging::LogVerbose("KeyInfo", "IDLE -> DEBOUNCING");
84+
state = DEBOUNCING;
8585
lastEventTime = timeNow;
8686
return false;
8787
}
@@ -95,35 +95,35 @@ IRAM_ATTR bool KeyInfo::Update(KeyConfig& config, Fract16 new_value) {
9595
}
9696
}
9797
break;
98-
case DEBUNCING:
98+
case DEBOUNCING:
9999
if (new_value <= config.low_threshold + config.activation_offset)
100100
{
101-
// MatrixOS::Logging::LogVerbose("KeyInfo", "DEBUNCING -> IDLE");
101+
// MatrixOS::Logging::LogVerbose("KeyInfo", "DEBOUNCING -> IDLE");
102102
state = IDLE;
103103
lastEventTime = timeNow;
104104
return false;
105105
}
106106
else if (timeNow - lastEventTime > config.debounce)
107107
{
108108
state = PRESSED;
109-
// MatrixOS::Logging::LogVerbose("KeyInfo", "DEBUNCING -> PRESSED");
109+
// MatrixOS::Logging::LogVerbose("KeyInfo", "DEBOUNCING -> PRESSED");
110110
lastEventTime = timeNow;
111111
values[0] = config.apply_curve ? ApplyForceCurve(config, new_value) : new_value;
112112
return true & !cleared; // I know just return "!cleared" works but I want to make it clear this is suppose to return true
113113
}
114114
return false;
115-
case RELEASE_DEBUNCING:
115+
case RELEASE_DEBOUNCING:
116116
if (BELOW_VALUE_THRESHOLD)
117117
{
118118
state = RELEASED;
119-
// MatrixOS::Logging::LogVerbose("KeyInfo", "RELEASE_DEBUNCING -> RELEASED");
119+
// MatrixOS::Logging::LogVerbose("KeyInfo", "RELEASE_DEBOUNCING -> RELEASED");
120120
lastEventTime = timeNow;
121121
return true & !cleared;
122122
}
123123
else if (ABOVE_THRESHOLD && timeNow - lastEventTime > config.debounce)
124124
{
125125
state = ACTIVATED;
126-
// MatrixOS::Logging::LogVerbose("KeyInfo", "RELEASE_DEBUNCING -> ACTIVATED");
126+
// MatrixOS::Logging::LogVerbose("KeyInfo", "RELEASE_DEBOUNCING -> ACTIVATED");
127127
lastEventTime = timeNow;
128128
}
129129
[[fallthrough]];
@@ -139,8 +139,8 @@ IRAM_ATTR bool KeyInfo::Update(KeyConfig& config, Fract16 new_value) {
139139
{
140140
if(config.debounce > 0)
141141
{
142-
state = RELEASE_DEBUNCING;
143-
// MatrixOS::Logging::LogVerbose("KeyInfo", "ACTIVATED -> RELEASE_DEBUNCING");
142+
state = RELEASE_DEBOUNCING;
143+
// MatrixOS::Logging::LogVerbose("KeyInfo", "ACTIVATED -> RELEASE_DEBOUNCING");
144144
lastEventTime = timeNow;
145145
return false;
146146
}

OS/Framework/KeyEvent/KeyInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ enum KeyState : uint8_t {
2020
AFTERTOUCH,
2121
RELEASED,
2222
/*Special*/
23-
DEBUNCING = 240u,
24-
RELEASE_DEBUNCING = 241u,
23+
DEBOUNCING = 240u,
24+
RELEASE_DEBOUNCING = 241u,
2525
/*Placeholder Keys*/
2626
INVALID = 255u
2727
};
2828

29-
29+
3030
struct KeyInfo {
3131
// Bit-packed structure for state and flags
3232
uint32_t lastEventTime = 0;

0 commit comments

Comments
 (0)