Make the 'On' button cycle between lights

This commit is contained in:
Sven van Heugten 2026-03-16 19:56:02 +01:00
parent 6e6a600e3c
commit 451d8b09f1
2 changed files with 11 additions and 3 deletions

View file

@ -95,8 +95,13 @@ type NightLightStateMachine private (maybeState: NightLightState option) =
| PressedOn ->
currentState
|> withAlarmOff
|> withStateFor RightBedroomLamp On
|> withStateFor LeftBedroomLamp On
|> match
currentState.LightToManualState[LeftBedroomLamp],
currentState.LightToManualState[RightBedroomLamp]
with
| Off, _ -> withStateFor LeftBedroomLamp On >> withStateFor RightBedroomLamp On
| On, On -> withStateFor LeftBedroomLamp On >> withStateFor RightBedroomLamp Off
| On, Off -> withStateFor LeftBedroomLamp Off >> withStateFor RightBedroomLamp On
| PressedOff ->
currentState
|> withAlarmOff