From 31c8c0496b2fb2e5a96443ff861550abc1ee5a0b Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 19 Jul 2025 09:12:29 -0400 Subject: [PATCH] Bugfix Zero runtime not reset runtime while charger connected I can't repro the users issue guessing its the difference with charging monitor vs not https://forums.rockbox.org/index.php/topic,55406.0.html Change-Id: I252f48cd24a9cb0fb2b899352fe9f9ac540a9a5b --- apps/gui/statusbar.c | 4 ++-- apps/settings.c | 7 ++++++- apps/settings.h | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index e14fa6a1b2..9eda934d2e 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -192,7 +192,7 @@ static struct screen * sb_fill_bar_info(struct gui_statusbar * bar) /* zero battery run time if charging */ if (charge_state > DISCHARGING) - reset_runtime(); + zero_runtime(); /* animate battery if charging */ if ((charge_state == DISCHARGING) || (charge_state == TRICKLE)) @@ -202,7 +202,7 @@ static struct screen * sb_fill_bar_info(struct gui_statusbar * bar) else { #else /* CONFIG_CHARGING < CHARGING_MONITOR */ - reset_runtime(); + zero_runtime(); { #endif /* CONFIG_CHARGING < CHARGING_MONITOR */ /* animate in (max.) 4 steps, starting near the current charge level */ diff --git a/apps/settings.c b/apps/settings.c index 5f96a1c470..8ee974f812 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -662,7 +662,7 @@ static void flush_config_block_callback(void) void reset_runtime(void) { update_runtime(); /* in case this is > topruntimetime */ - lasttime = current_tick; + zero_runtime(); global_status.runtime = 0; } @@ -681,6 +681,11 @@ void update_runtime(void) global_status.topruntime = global_status.runtime; } +void zero_runtime(void) +{ + lasttime = current_tick; +} + void status_save(bool force) { if(force) diff --git a/apps/settings.h b/apps/settings.h index 7d8da0199a..65f43663db 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -262,13 +262,15 @@ enum { ALARM_START_WPS = 0, /** function prototypes **/ +void reset_runtime(void); void update_runtime(void); +void zero_runtime(void); void settings_load(void) INIT_ATTR; bool settings_load_config(const char* file, bool apply); void status_save(bool force); int settings_save(void); -void reset_runtime(void); + /* defines for the options paramater */ enum { SETTINGS_SAVE_CHANGED = 0,