Detect under-voltage on GPIO1/11, persist UV state in NVS, enter a minimal power mode without ESP-NOW, and recover after charge; expose LED mode 6 battery-low for host testing via goTool. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
462 B
Go
27 lines
462 B
Go
package autotest
|
|
|
|
import "testing"
|
|
|
|
func TestLedRingModeValue(t *testing.T) {
|
|
tests := []struct {
|
|
mode string
|
|
want uint32
|
|
}{
|
|
{"clear", 0},
|
|
{"progress", 1},
|
|
{"digit", 2},
|
|
{"blink", 3},
|
|
{"find-me", 4},
|
|
{"battery-low", 6},
|
|
}
|
|
for _, tc := range tests {
|
|
got, err := ledRingModeValue(tc.mode)
|
|
if err != nil {
|
|
t.Fatalf("mode %q: %v", tc.mode, err)
|
|
}
|
|
if got != tc.want {
|
|
t.Fatalf("mode %q = %d want %d", tc.mode, got, tc.want)
|
|
}
|
|
}
|
|
}
|