0x41
This commit is contained in:
13
client.go
13
client.go
@@ -1188,15 +1188,9 @@ func (mc *ModbusClient) readRegistersWithFunctionCode(addr uint16, quantity uint
|
||||
unitId: mc.unitId,
|
||||
}
|
||||
|
||||
// if functionCode != fcCustomize {
|
||||
// err = ErrUnexpectedParameters
|
||||
// mc.logger.Errorf("unexpected function code (%d)", functionCode)
|
||||
// return
|
||||
// }
|
||||
|
||||
if functionCode == 0 {
|
||||
if functionCode != fcCustomize {
|
||||
err = ErrUnexpectedParameters
|
||||
mc.logger.Errorf("unexpected register type (%v)", functionCode)
|
||||
mc.logger.Errorf("unexpected function code (%d)", functionCode)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1208,7 +1202,8 @@ func (mc *ModbusClient) readRegistersWithFunctionCode(addr uint16, quantity uint
|
||||
return
|
||||
}
|
||||
|
||||
if quantity > 1024 {
|
||||
// 16 * 16 * 40
|
||||
if quantity > 10240 {
|
||||
err = ErrUnexpectedParameters
|
||||
mc.logger.Error("quantity of registers exceeds 1024")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user