Use standard timeout checker for GhostInTheFirmware

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/642/head
Michael Richters 6 years ago
parent ecfc9d935a
commit f62c0f631b

@ -46,11 +46,11 @@ EventHandlerResult GhostInTheFirmware::beforeReportingState() {
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
is_pressed_ = true; is_pressed_ = true;
start_time_ = millis(); start_time_ = Kaleidoscope.millisAtCycleStart();
} else { } else {
if (is_pressed_ && ((millis() - start_time_) > press_timeout_)) { if (is_pressed_ && Kaleidoscope.hasTimeExpired(start_time_, press_timeout_)) {
is_pressed_ = false; is_pressed_ = false;
start_time_ = millis(); start_time_ = Kaleidoscope.millisAtCycleStart();
byte row = pgm_read_byte(&(ghost_keys[current_pos_].row)); byte row = pgm_read_byte(&(ghost_keys[current_pos_].row));
byte col = pgm_read_byte(&(ghost_keys[current_pos_].col)); byte col = pgm_read_byte(&(ghost_keys[current_pos_].col));
@ -61,7 +61,7 @@ EventHandlerResult GhostInTheFirmware::beforeReportingState() {
byte col = pgm_read_byte(&(ghost_keys[current_pos_].col)); byte col = pgm_read_byte(&(ghost_keys[current_pos_].col));
handleKeyswitchEvent(Key_NoKey, row, col, IS_PRESSED); handleKeyswitchEvent(Key_NoKey, row, col, IS_PRESSED);
} else if ((millis() - start_time_) > delay_timeout_) { } else if (Kaleidoscope.hasTimeExpired(start_time_, delay_timeout_)) {
current_pos_++; current_pos_++;
press_timeout_ = 0; press_timeout_ = 0;
} }

Loading…
Cancel
Save