Skip to content

Commit

Permalink
Using fade everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Suderman committed Jan 19, 2020
1 parent 0fac9f3 commit a8397dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions control.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var onCmd = &cobra.Command{
}
defer led.ws.Fini()

_ = led.display(colors[colorName], 0, onBrightness)
_ = led.fade(colors[colorName], onBrightness)
},
}

Expand All @@ -41,6 +41,6 @@ var offCmd = &cobra.Command{
}
defer led.ws.Fini()

_ = led.display(off, 0, 0)
_ = led.fade(off, 0)
},
}
4 changes: 2 additions & 2 deletions homekit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
5 changes: 4 additions & 1 deletion neopixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a8397dd

Please sign in to comment.