feat(battery): implement emergency safe shutdown when battery <= 5% discharging
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
- Add should_shutdown() check in BatteryPolicy and trigger_shutdown() in phone-battery-guard.py. - Auto sync filesystems and invoke safe poweroff if SoC drops to 5% while on battery/discharging. - Do not power off if external charger is actively connected and charging. - Update openrc service command args with --shutdown-at 5. - Add unit tests for emergency shutdown, discharging detection, and threshold validation.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/sbin/openrc-run
|
||||
description="Platina battery health and anti-swelling daemon (maintains 50-65% SoC)"
|
||||
description="Platina battery health and emergency shutdown daemon (50-65% SoC, auto-poweroff <= 5%)"
|
||||
command="/usr/local/sbin/platina-battery-guard"
|
||||
command_user="root:root"
|
||||
command_args="--low ${low:-50} --high ${high:-65} --max-temp ${max_temp:-45} --interval ${interval:-60}"
|
||||
command_args="--low ${low:-50} --high ${high:-65} --max-temp ${max_temp:-45} --shutdown-at ${shutdown_at:-5} --interval ${interval:-60}"
|
||||
command_background="yes"
|
||||
pidfile="/run/platina-battery-guard.pid"
|
||||
output_log="/var/log/platina-battery-guard.log"
|
||||
|
||||
Reference in New Issue
Block a user