Add runtime UV protection toggle and treat near-zero sense as external power.
Per-pod NVS enable (default off) via UART/ESP-NOW/dashboard, and skip UV latch when LiPo ADC reads ~0 mV so USB/external supply still boots. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"powerpod/gotool/pb"
|
||||
)
|
||||
|
||||
func runBatteryUv(sp *serialPort, args []string) error {
|
||||
fs := flag.NewFlagSet("battery-uv", flag.ExitOnError)
|
||||
write := fs.Bool("set", false, "write UV protection enable (default: read)")
|
||||
enabled := fs.Bool("enable", false, "enable software UV protection")
|
||||
clientID := fs.Uint("client", 0, "client id (0=local master)")
|
||||
all := fs.Bool("all", false, "apply to master + all registered slaves")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r, err := sp.batteryUv(&pb.BatteryUvRequest{
|
||||
Write: *write,
|
||||
Enabled: *enabled,
|
||||
ClientId: uint32(*clientID),
|
||||
AllClients: *all,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("client_id=%d success=%v enabled=%v latched=%v slaves_updated=%d\n",
|
||||
r.GetClientId(), r.GetSuccess(), r.GetEnabled(), r.GetLatched(),
|
||||
r.GetSlavesUpdated())
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user