Main Menu: Fix MNTM style battery percent off by 1 (#339)

* Battery: MNTM menu style battery off by 1

- Uses the same `furi_hal_power_get_pct` function used on the desktop to fix the apparent rounded error that's happening and show the same battery %.

* Update changelog

---------

Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
Alexander Bays
2025-01-12 20:39:46 -06:00
committed by GitHub
parent 4d58cdd557
commit 7d4ea20701
2 changed files with 2 additions and 3 deletions

View File

@@ -44,6 +44,7 @@
### Fixed:
- Desktop: Fixed Wardriving animation design (by @Davim09)
- Main Menu: Fix MNTM style battery percent off by 1 (#339 by @956MB)
- OFW: Fix lost BadBLE keystrokes (by @Astrrra)
- OFW: GPIO: Fix USB UART Bridge Crash by increasing system stack size (by @Astrrra)
- OFW: Loader: Fix BusFault in handling of OOM (by @Willy-JL)

View File

@@ -391,10 +391,8 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
snprintf(clk, sizeof(clk), "%02u:%02u", hour, min);
canvas_draw_str(canvas, 5, 34, clk);
uint32_t battery_capacity = furi_hal_power_get_battery_full_capacity();
uint32_t battery_remaining = furi_hal_power_get_battery_remaining_capacity();
bool ext5v = furi_hal_power_is_otg_enabled();
uint16_t battery_percent = (battery_remaining * 100) / battery_capacity;
uint8_t battery_percent = furi_hal_power_get_pct();
bool charge_state = false;
// Determine charge state