From 56a5060fa1aed47a1365549d7ebb5b4682287fd2 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Wed, 10 Apr 2024 17:42:24 -0700 Subject: [PATCH] Fix powerscreen.c --- src/ui/powerscreen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/powerscreen.c b/src/ui/powerscreen.c index ee5b7cf..268281a 100644 --- a/src/ui/powerscreen.c +++ b/src/ui/powerscreen.c @@ -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);