From cc334e5040975873592b17ab962af0205c657952 Mon Sep 17 00:00:00 2001 From: Christoph Schiessl Date: Wed, 2 May 2018 08:17:51 +0200 Subject: [PATCH] fix(battery): check current state to decide which framerate to use --- src/modules/battery.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 067e37e3..1a898191 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -332,7 +332,7 @@ namespace modules { } /** - * Subthread runner that emit update events to refresh + * Subthread runner that emits update events to refresh * or in case they are used. Note, that it is ok to * use a single thread, because the two animations are never shown at the * same time. @@ -340,9 +340,9 @@ namespace modules { void battery_module::subthread() { chrono::duration dur{0.0}; - if (m_animation_charging) { + if (battery_module::state::CHARGING == m_state && m_animation_charging) { dur += chrono::milliseconds{m_animation_charging->framerate()}; - } else if (m_animation_discharging) { + } else if (battery_module::state::DISCHARGING == m_state && m_animation_discharging) { dur += chrono::milliseconds{m_animation_discharging->framerate()}; } else { dur += 1s;