add another check

This commit is contained in:
Josh Deprez 2021-02-02 16:25:58 +11:00
parent 27d7a7149a
commit 3f886b0dfd

View file

@ -103,6 +103,9 @@ func readRegs(client modbus.Client, start, qty uint16) {
if err != nil {
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 {
if addr <= start || addr > start+qty {
continue