优化自定义功能码数据读取校验 #3

Merged
Fuyao merged 1 commits from cfy-feat-dev into main 2025-11-13 15:23:39 +08:00
Showing only changes of commit f79cf0243b - Show all commits

View File

@@ -1188,11 +1188,11 @@ func (mc *ModbusClient) readRegistersWithFunctionCode(addr uint16, quantity uint
unitId: mc.unitId, unitId: mc.unitId,
} }
if functionCode != fcCustomize { // if functionCode != fcCustomize {
err = ErrUnexpectedParameters // err = ErrUnexpectedParameters
mc.logger.Errorf("unexpected function code (%d)", functionCode) // mc.logger.Errorf("unexpected function code (%d)", functionCode)
return // return
} // }
if functionCode == 0 { if functionCode == 0 {
err = ErrUnexpectedParameters err = ErrUnexpectedParameters