OneShot: Remove some obsolete optimizations

In `beforeReportingState()` and `afterEachCycle()` we used to return early if no
OneShots were active. This was easy to do when we were using a bitfield, we'd
just tested for non-zero. Since we're using an array now, this check is more
expensive, and the extra work negates any benefit of returning early.

For this reason, these early returns are removed.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/567/head
Gergely Nagy 6 years ago
parent 926cb07f85
commit a4af4f4a2b
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -163,9 +163,6 @@ EventHandlerResult OneShot::onKeyswitchEvent(Key &mapped_key, byte row, byte col
}
EventHandlerResult OneShot::beforeReportingState() {
if (!isActive())
return EventHandlerResult::OK;
for (uint8_t i = 0; i < 8; i++) {
if (state_[i].active) {
activateOneShot(i);
@ -176,9 +173,6 @@ EventHandlerResult OneShot::beforeReportingState() {
}
EventHandlerResult OneShot::afterEachCycle() {
if (!isActive())
return EventHandlerResult::OK;
if (hasTimedOut())
cancel();

Loading…
Cancel
Save