From 04ba5a661716120925e7b229c8343712901096b3 Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 19 Jan 2018 23:20:44 +0000 Subject: [PATCH] Do not spin when battery is unplugged --- src/battery/battery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/battery/battery.c b/src/battery/battery.c index eb8ae62..6f4c07f 100644 --- a/src/battery/battery.c +++ b/src/battery/battery.c @@ -225,7 +225,8 @@ void init_battery() battery_found = battery_os_init(); - change_timer(&battery_timer, true, battery_found ? 10 : 30000, 30000, update_battery_tick, 0); + if (!battery_timer.enabled_) + change_timer(&battery_timer, true, 30000, 30000, update_battery_tick, 0); update_battery(); } @@ -272,6 +273,7 @@ void init_battery_panel(void *p) bat1_format = strdup("%p"); bat2_format = strdup("%t"); } + update_battery_tick(NULL); } void battery_init_fonts()