The SetState method discards the return code from fadeToRgbBlink1. If the app cannot write (because, say, the blink(1) got unplugged) then this will fail silently.
Fix: change SetState to:
func (b *Device) SetState(state State) (err error) {
b.CurrentState = state
bytes := fadeToRgbBlink1(b, state.FadeTime, state.Red, state.Green, state.Blue, state.Normal)
if bytes <= 0 {
err = errors.New("Unable to write to blink(1).")
}
return
}
The SetState method discards the return code from fadeToRgbBlink1. If the app cannot write (because, say, the blink(1) got unplugged) then this will fail silently.
Fix: change SetState to:
func (b *Device) SetState(state State) (err error) { b.CurrentState = state bytes := fadeToRgbBlink1(b, state.FadeTime, state.Red, state.Green, state.Blue, state.Normal) if bytes <= 0 { err = errors.New("Unable to write to blink(1).") } return }