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>
35 lines
887 B
Go
35 lines
887 B
Go
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
|
|
}
|