From a6052be0f16934b854293bc9241329b1d675586f Mon Sep 17 00:00:00 2001 From: Nikolay Minaylov Date: Thu, 15 Sep 2022 17:13:48 +0300 Subject: [PATCH] Charging icon update fix (#1733) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Power: refresh battery indicator on charger plug/unplug Co-authored-by: SG Co-authored-by: あく --- applications/services/power/power_service/power.c | 2 ++ applications/services/power/power_service/power.h | 1 + 2 files changed, 3 insertions(+) diff --git a/applications/services/power/power_service/power.c b/applications/services/power/power_service/power.c index 3a2c6cf3..85d217f2 100644 --- a/applications/services/power/power_service/power.c +++ b/applications/services/power/power_service/power.c @@ -127,6 +127,7 @@ static void power_check_charging_state(Power* power) { static bool power_update_info(Power* power) { PowerInfo info; + info.is_charging = furi_hal_power_is_charging(); info.gauge_is_ok = furi_hal_power_gauge_is_ok(); info.charge = furi_hal_power_get_pct(); info.health = furi_hal_power_get_bat_health_pct(); @@ -142,6 +143,7 @@ static bool power_update_info(Power* power) { furi_mutex_acquire(power->api_mtx, FuriWaitForever); bool need_refresh = power->info.charge != info.charge; + need_refresh |= power->info.is_charging != info.is_charging; power->info = info; furi_mutex_release(power->api_mtx); diff --git a/applications/services/power/power_service/power.h b/applications/services/power/power_service/power.h index b623452e..bdf5fa52 100644 --- a/applications/services/power/power_service/power.h +++ b/applications/services/power/power_service/power.h @@ -36,6 +36,7 @@ typedef struct { typedef struct { bool gauge_is_ok; + bool is_charging; float current_charger; float current_gauge;