[FL-3051] Gauge initialization routine refactoring, new DataMemory layout, configuration update (#2887)

* FuriHal: refactor power gauge config

* Format sources and move gauge DM load to separate method

* FuriHal: bq27220 refactoring part 1

* Power: use SYSDWN battery status flag for system shutdown

* Libs: bq27220 read DM before write, fix incorrect shift

* FuriHal: cleanup gauge config, add flags, add ptr DM type, update symbols

* FuriHal: 2 stage gauge DM verification and update, better detection routine

* FuriHal: update gauge configuration, lower sleep current and deadband

* FuriHal: gauge and charger health reporting

* Lib: cleanup bq27220 sources

* FuriHal: correct documentation for furi_hal_power_is_shutdown_requested

* FuriHal: proper gauge config for f7
This commit is contained in:
あく
2023-07-18 14:46:38 +04:00
committed by GitHub
parent 309f65e401
commit 76e97b8d35
17 changed files with 626 additions and 250 deletions

View File

@@ -117,6 +117,7 @@ static bool power_update_info(Power* power) {
info.is_charging = furi_hal_power_is_charging();
info.gauge_is_ok = furi_hal_power_gauge_is_ok();
info.is_shutdown_requested = furi_hal_power_is_shutdown_requested();
info.charge = furi_hal_power_get_pct();
info.health = furi_hal_power_get_bat_health_pct();
info.capacity_remaining = furi_hal_power_get_battery_remaining_capacity();
@@ -145,7 +146,7 @@ static void power_check_low_battery(Power* power) {
}
// Check battery charge and vbus voltage
if((power->info.charge == 0) && (power->info.voltage_vbus < 4.0f) &&
if((power->info.is_shutdown_requested) && (power->info.voltage_vbus < 4.0f) &&
power->show_low_bat_level_message) {
if(!power->battery_low) {
view_dispatcher_send_to_front(power->view_dispatcher);

View File

@@ -37,6 +37,7 @@ typedef struct {
typedef struct {
bool gauge_is_ok;
bool is_charging;
bool is_shutdown_requested;
float current_charger;
float current_gauge;