feat(ota): defer updates when battery is low

This commit is contained in:
chenjintao
2026-08-20 17:26:11 +08:00
parent 8d3d66c45f
commit 0542aadaa4
6 changed files with 369 additions and 0 deletions
+10
View File
@@ -10,6 +10,16 @@ exact byte size, SHA-256, and the `force`/`update` decision. Non-forced images
wait for the mini-program confirmation (`update=1`); forced images proceed
without that confirmation.
After an update is approved, the control plane checks the latest valid battery
snapshot before downloading the image. A battery percentage below
`CONFIG_TQ_OTA_MIN_BATTERY_PERCENT`, an unavailable sample, or a stale sample
puts the worker in `CONTROL_PLANE_OTA_STATE_WAITING_FOR_POWER`. This is a
deferred safety condition rather than an OTA failure, so it does not increment
the failure counter. Forced updates do not bypass the gate. The worker releases
voice resources and reports the version again after
`CONFIG_TQ_OTA_POWER_RETRY_MS`, which also obtains a fresh expiring download
URL. Once installation starts, later percentage changes do not cancel it.
Before an HTTPS exchange, the worker quiesces local wake and multimodal voice
services, waits for transport teardown, and checks internal/DMA memory
headroom. The platform layer streams the image into the inactive OTA