Skip to content

Commit 56815cc

Browse files
committed
Fix rgb driver color handling
1 parent 030eb05 commit 56815cc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ topic = "lighthouse"
66
[boards.alpha]
77
serial = "/dev/ttyUSB0"
88
[boards.alpha.dev]
9-
[boards.alpha.dev.led]
10-
mode = "pwm"
9+
[boards.alpha.dev.rgb]
10+
mode = "rgb"
1111
inverted = false
12-
pins = ["9"]
12+
pins = ["9", "10", "11"]
1313

1414
[boards.alpha.dev.internal]
1515
mode = "direct"

driver/rgb.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ func parseColor(params map[string]interface{}) (color, error) {
8888
return color{}, errors.New("Missing color parameters")
8989
}
9090

91-
red, okR := valR.(byte)
92-
green, okG := valG.(byte)
93-
blue, okB := valB.(byte)
91+
red, okR := valR.(float64)
92+
green, okG := valG.(float64)
93+
blue, okB := valB.(float64)
9494

9595
if !(okR && okG && okB) {
9696
return color{}, errors.New("Invalid color parameters")
9797
}
9898

99-
return color{red, green, blue}, nil
99+
return color{uint8(red), uint8(green), uint8(blue)}, nil
100100
}
101101

102102
func newRgbDriver(cfg config.DeviceConfig, connection gpio.DigitalWriter) (*rgbDriver, error) {

0 commit comments

Comments
 (0)