mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-16 20:09:44 -07:00
Power: refresh battery indicator on charger plug/unplug
OFW PR 1733 by nminaylov
This commit is contained in:
@@ -180,6 +180,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();
|
||||
@@ -195,6 +196,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);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
bool gauge_is_ok;
|
||||
bool is_charging;
|
||||
|
||||
float current_charger;
|
||||
float current_gauge;
|
||||
|
||||
Reference in New Issue
Block a user