Skip to content

Commit

Permalink
Charging icon update fix (flipperdevices#1733)
Browse files Browse the repository at this point in the history
* Power: refresh battery indicator on charger plug/unplug

Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
  • Loading branch information
3 people authored Sep 15, 2022
1 parent d9573d3 commit 6e3114a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions applications/services/power/power_service/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);

Expand Down
1 change: 1 addition & 0 deletions applications/services/power/power_service/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef struct {

typedef struct {
bool gauge_is_ok;
bool is_charging;

float current_charger;
float current_gauge;
Expand Down

0 comments on commit 6e3114a

Please sign in to comment.