add another check
This commit is contained in:
parent
27d7a7149a
commit
3f886b0dfd
1 changed files with 3 additions and 0 deletions
3
main.go
3
main.go
|
@ -103,6 +103,9 @@ func readRegs(client modbus.Client, start, qty uint16) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Couldn't read input registers %d-%d: %v", start+1, start+qty, err)
|
log.Fatalf("Couldn't read input registers %d-%d: %v", start+1, start+qty, err)
|
||||||
}
|
}
|
||||||
|
if len(data) != int(2*qty) {
|
||||||
|
log.Fatalf("Couldn't 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 {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue