Clear the previous key when a new one is pressed

When we light up a new key, clear the previous one (but only if it isn't the
same, to avoid flickering).

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago committed by Gergely Nagy
parent 49720378bd
commit 91380a81c8

@ -57,16 +57,20 @@ namespace KaleidoscopePlugins {
return key; return key;
uint8_t displayCol = 2; uint8_t displayCol = 2;
Key prevKey = lastKeyLeft;
if (col < COLS / 2) { if (col < COLS / 2) {
lastKeyLeft = key; lastKeyLeft = key;
endTimeLeft = millis () + length; endTimeLeft = millis () + length;
} else { } else {
prevKey = lastKeyRight;
lastKeyRight = key; lastKeyRight = key;
endTimeRight = millis () + length; endTimeRight = millis () + length;
displayCol = 10; displayCol = 10;
} }
if (prevKey != key)
::AlphaSquare.clear (prevKey, displayCol);
::AlphaSquare.display (key, displayCol); ::AlphaSquare.display (key, displayCol);
return key; return key;
} }

Loading…
Cancel
Save