added support for color correction

This commit is contained in:
2019-05-05 21:30:02 +02:00
parent 75d3c41a5c
commit eb2a0e7a98
3 changed files with 5 additions and 5 deletions

View File

@@ -91,7 +91,7 @@ func (daemon *LedDaemon) receive() {
daemon.name = msg.MLedd.Name
log.Infof("Connection with %s established; backend registered", msg.MLedd.Name)
case *ledd.BackendWrapperMessage_MSetChannel:
for c, v := range msg.MSetChannel.NewChannelValues {
for c, v := range msg.MSetChannel.Values {
if c > CHANNEL {
log.Warningf("[%s] Channel index %d is higher then this device's max channel index %d. Skipping.", daemon.name, c, CHANNEL)
continue
@@ -100,10 +100,10 @@ func (daemon *LedDaemon) receive() {
v = math.Pow(v, 1/readConfig.Pca9685.Gamma)
if pwm, ok := pwmMap[c]; ok {
pwm.setPercentage(float32(v * 100))
pwm.setPercentage(float32(v) * 100 * msg.MSetChannel.Correction[c])
} else {
pwmMap[c] = pca9685.NewPwm(int(c))
pwmMap[c].setPercentage(float32(v * 100))
pwm.setPercentage(float32(v) * 100 * msg.MSetChannel.Correction[c])
}
}
}