Commit 4f5becbd authored by Sven Greiner's avatar Sven Greiner

Remove fast press overflow handling

If we assume that the config case in the switch statement is reached
before the user can tap a second time [1] there is no need to handle
overflow of fast_presses in a separate if statement. Instead it is
enough to set fast_presses to the current value minus one so that when a
possible next press of the power switch increments the counter again
this results in the same case.

This saves 6 bytes of flash.

[1] Which is unlikely because the execution time until this point is
much shorter than human repetitive finger movement, so only button
bouncing can be an issue and that would require other measures
parent 584ac5d7
......@@ -414,11 +414,6 @@ int main(void) {
} else { // User has tapped the power button
// TODO Optimize overflow handling
if (fast_presses > 10) {
fast_presses = 10;
// Input handling
switch (fast_presses) {
......@@ -439,6 +434,7 @@ int main(void) {
#endif // ifdef BEACON
state = kConfig;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment