feat(battery): enhance battery guard with thermal runaway protection and openrc service

- Add max_temp thermal protection with 3°C hysteresis to prevent high-temp battery swelling.
- Provide scripts/phone-battery-guard.openrc for automated OpenRC service management.
- Update tests/test_battery_guard.py with thermal throttling tests.
This commit is contained in:
shen
2026-11-08 05:26:21 -08:00
parent 810a467ad3
commit db9d190d7b
3 changed files with 72 additions and 6 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/sbin/openrc-run
description="Platina battery health and anti-swelling daemon (maintains 50-65% SoC)"
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_background="yes"
pidfile="/run/platina-battery-guard.pid"
output_log="/var/log/platina-battery-guard.log"
error_log="/var/log/platina-battery-guard.log"
depend() {
need localmount
after udev-trigger
}
start_pre() {
checkpath --file --mode 0640 --owner root:root "$output_log"
}