Document state transitions

This commit is contained in:
Ian Gulliver
2022-09-24 17:24:37 -07:00
parent 035df9e7fd
commit 75d2df1aa5

View File

@@ -84,6 +84,13 @@ func main() {
}
}
// States:
// on 0, off *, r Off, onUntil zero -> stable
// on 1, off *, r Off, onUntil zero -> turn on
// on *, off *, r On, onUntil future -> stay on
// on *, off *, r On, onUntil past -> turn off
// on *, off all, r Off, onUntil past -> reset state
if on > 0 {
// At least one on, turn on
if onUntil.IsZero() {
@@ -97,6 +104,7 @@ func main() {
}
}
// Time target expired
if !onUntil.IsZero() && onUntil.Before(time.Now()) {
r.Off()
}