fixed wrong led off/on register setting

This commit is contained in:
2019-05-03 20:25:45 +02:00
parent 1500fa5d93
commit 5c2fe2f073
3 changed files with 14 additions and 17 deletions

17
main.go
View File

@@ -1,19 +1,18 @@
package main
import (
"encoding/binary"
"fmt"
"gen/ledd"
"github.com/golang/protobuf/proto"
"github.com/op/go-logging"
"golang.org/x/exp/io/i2c"
"gopkg.in/yaml.v2"
"io/ioutil"
"net"
"os"
"os/signal"
"syscall"
"io/ioutil"
"net"
"encoding/binary"
"gen/ledd"
"github.com/golang/protobuf/proto"
"fmt"
"math"
)
// CONSTANTS
@@ -89,7 +88,7 @@ func (daemon *LedDaemon) receive() {
switch msg := backendMsg.Msg.(type) {
case *ledd.BackendWrapperMessage_MLedd:
daemon.name = msg.MLedd.Name
log.Infof("Connection with %s etablished; backend registered", 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 {
if c > CHANNEL {
@@ -98,7 +97,7 @@ func (daemon *LedDaemon) receive() {
}
vPerc := float64(v) / float64(RESOLUTION)
vPerc = math.Pow(vPerc, 1/readConfig.Pca9685.Gamma)
//vPerc = math.Pow(vPerc, 1/readConfig.Pca9685.Gamma)
if pwm, ok := pwmMap[c]; ok {
pwm.setPercentage(float32(vPerc * 100))