diff --git a/control.go b/control.go index df715c4..589dcab 100644 --- a/control.go +++ b/control.go @@ -26,7 +26,7 @@ var onCmd = &cobra.Command{ } defer led.ws.Fini() - _ = led.display(colors[colorName], 0, onBrightness) + _ = led.fade(colors[colorName], onBrightness) }, } @@ -41,6 +41,6 @@ var offCmd = &cobra.Command{ } defer led.ws.Fini() - _ = led.display(off, 0, 0) + _ = led.fade(off, 0) }, } diff --git a/homekit.go b/homekit.go index cb2393a..cf1cea6 100644 --- a/homekit.go +++ b/homekit.go @@ -55,7 +55,7 @@ func startHomekit() { } } else { klog.Infof("Switch is off") - err = led.display(off, 0, 0) + err = led.fade(off, 0) if err != nil { klog.Error(err) } @@ -80,7 +80,7 @@ func startHomekit() { hc.OnTermination(func() { klog.Info("terminated. turning off lights") - err = led.display(off, 0, 0) + err = led.fade(off, 0) if err != nil { klog.Error(err) } diff --git a/neopixel.go b/neopixel.go index 37bd1a8..5ee72a8 100644 --- a/neopixel.go +++ b/neopixel.go @@ -68,7 +68,10 @@ func newLEDArray() (*LEDArray, error) { // brightness: sets the brightness for the entire thing func (led *LEDArray) display(color uint32, delay int, brightness int) error { klog.V(6).Infof("setting led array to color: %d, delay: %d, brightness: %d", color, delay, brightness) - led.ws.SetBrightness(0, brightness) + err := led.setBrightness(brightness) + if err != nil { + return err + } for i := 0; i < len(led.ws.Leds(0)); i++ { led.ws.Leds(0)[i] = color klog.V(10).Infof("setting led %d", i)