make log better

This commit is contained in:
Josh Deprez 2021-02-03 21:28:24 +11:00
parent fd006cdccb
commit ad38fcaf8d

View file

@ -113,10 +113,10 @@ func readRegs(client modbus.Client, start, qty uint16) {
val, err := reg.read(data[(addr-start-1)*2:]) val, err := reg.read(data[(addr-start-1)*2:])
if err != nil { if err != nil {
if errors.Is(err, errSkippableRead) { if errors.Is(err, errSkippableRead) {
log.Printf("Couldn't parse input register data, skipping: %v", err) log.Printf("Couldn't parse input register data at %d, skipping: %v", addr, err)
continue continue
} }
log.Fatalf("Couldn't parse input register data: %v", err) log.Fatalf("Couldn't parse input register data at %d: %v", addr, err)
} }
//fmt.Printf("%s: %v %s\n", reg.name, val, reg.unit) //fmt.Printf("%s: %v %s\n", reg.name, val, reg.unit)
registerGauges[addr].Set(val) registerGauges[addr].Set(val)