Power: Suppress Shutdown on Idle While Charging / Plugged In (#244)

* Update power.c

* Update power.c

Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com>

* Update power.c

Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com>

* Format

* Also restart timer when plugged in but fully charged

avoids the 'it is now safe to unplug cable' screen

* Update changelog

---------

Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
Luu
2024-10-08 06:17:05 +02:00
committed by GitHub
parent ae70945238
commit eef9c42be7
2 changed files with 10 additions and 2 deletions

View File

@@ -93,6 +93,7 @@
- Desktop:
- Fallback Poweroff prompt when power settings is unavailable (by @Willy-JL)
- Sub-GHz: Fix GPS "Latitute" typo, switch to "Lat" and "Lon" in .sub files (#246 by @m7i-org)
- Power: Suppress Shutdown on Idle While Charging / Plugged In (#244 by @luu176)
- Storage:
- Fallback SD format prompt when storage settings is unavailable (by @Willy-JL)
- OFW: Fix folder rename fails (by @portasynthinca3)

View File

@@ -333,8 +333,15 @@ static void power_storage_callback(const void* message, void* context) {
static void power_auto_shutdown_timer_callback(void* context) {
furi_assert(context);
Power* power = context;
power_auto_shutdown_inhibit(power);
power_off(power);
// Suppress shutdown on idle while charging to avoid the battery from not charging fully. Then restart timer back to original timeout.
if(power->state != PowerStateNotCharging) {
FURI_LOG_D(TAG, "Plugged in, reset idle timer");
power_auto_shutdown_arm(power);
} else {
power_auto_shutdown_inhibit(power);
power_off(power);
}
}
static void power_apply_settings(Power* power) {