tweak error messages
This commit is contained in:
parent
00b58cbdb9
commit
fa7b18bc2d
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -134,7 +134,7 @@ func readRegs(client modbus.Client, start, qty uint16) error {
|
||||||
return fmt.Errorf("read input registers %d-%d: %v", start+1, start+qty, err)
|
return fmt.Errorf("read input registers %d-%d: %v", start+1, start+qty, err)
|
||||||
}
|
}
|
||||||
if len(data) != int(2*qty) {
|
if len(data) != int(2*qty) {
|
||||||
return fmt.Errorf("reading input registers %d-%d: len(data) = %d != %d = 2*qty", start+1, start+qty, len(data), 2*qty)
|
return fmt.Errorf("read input registers %d-%d: len(data) = %d != %d = 2*qty", start+1, start+qty, len(data), 2*qty)
|
||||||
}
|
}
|
||||||
for addr, reg := range sungrowInputRegs {
|
for addr, reg := range sungrowInputRegs {
|
||||||
if addr <= start || addr > start+qty {
|
if addr <= start || addr > start+qty {
|
||||||
|
@ -146,7 +146,7 @@ func readRegs(client modbus.Client, start, qty uint16) error {
|
||||||
log.Printf("Couldn't parse input register data at %d, skipping: %v", addr, err)
|
log.Printf("Couldn't parse input register data at %d, skipping: %v", addr, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return fmt.Errorf("parsing input register data at %d: %v", addr, err)
|
return fmt.Errorf("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)
|
||||||
lastValues[addr] = val
|
lastValues[addr] = val
|
||||||
|
|
Loading…
Reference in a new issue