Fix powerscreen.c

This commit is contained in:
Alexander Rosenberg 2024-04-10 17:42:24 -07:00
parent 8c638f00a5
commit 56a5060fa1
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -45,8 +45,11 @@ static bool power_screen_dispatch(PowerScreen *screen,
return true;
}
}
screen->choice = abs((screen->choice + state->up_down - state->down_down) %
POWER_SCREEN_NCHOICE);
screen->choice = (screen->choice + state->up_down - state->down_down) %
POWER_SCREEN_NCHOICE;
if (screen->choice < 0) {
screen->choice = POWER_SCREEN_NCHOICE - screen->choice;
}
if (state->force_draw || state->up_down || state->down_down) {
lcd_clear(state->lcd);
lcd_move_to(state->lcd, 0, 0);