factor out "normal" mode changes
This commit is contained in:
parent
2dc9133e0a
commit
aab533caaf
18
main.go
18
main.go
@ -207,16 +207,16 @@ func loop(inside *lighthardware, inside2 *lighthardware, outside *lighthardware,
|
||||
for {
|
||||
select {
|
||||
case <-inBrightChange:
|
||||
ledset(inside.rPwm, inside.rCh, brightIn)
|
||||
ledset(inside.gPwm, inside.gCh, brightIn)
|
||||
ledset(inside.bPwm, inside.bCh, brightIn)
|
||||
ledset(inside2.rPwm, inside2.rCh, brightIn)
|
||||
ledset(inside2.gPwm, inside2.gCh, brightIn)
|
||||
ledset(inside2.bPwm, inside2.bCh, brightIn)
|
||||
normal(inside, brightIn)
|
||||
normal(inside2, brightIn)
|
||||
case <-outBrightChange:
|
||||
ledset(outside.rPwm, outside.rCh, brightOut)
|
||||
ledset(outside.gPwm, outside.gCh, brightOut)
|
||||
ledset(outside.bPwm, outside.bCh, brightOut)
|
||||
normal(outside, brightOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func normal(light *lighthardware, brightness uint32) {
|
||||
ledset(light.rPwm, light.rCh, brightness)
|
||||
ledset(light.gPwm, light.gCh, brightness)
|
||||
ledset(light.bPwm, light.bCh, brightness)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user