From 828d914304e29f5d8202df87393ce6744e528fdd Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期三, 01 二月 2023 11:59:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/klink' into kNet --- Src/ModbusRTU.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Src/ModbusRTU.c b/Src/ModbusRTU.c index bd939f3..154b21c 100644 --- a/Src/ModbusRTU.c +++ b/Src/ModbusRTU.c @@ -86,12 +86,12 @@ int ModBusSlaveCheckPkg(int nChn, void *ptr, uint16_t len1) { - if (len1 <=4) return -1; //包长 + if (len1 <=4) return -1; //鍖呴暱 pModBusRTUReqPkg pPkg = (pModBusRTUReqPkg) ptr; - if (pPkg->Dst >127) return -2; //地址码 - if ((pPkg->Cmd&0x7f) > 0x1f) return -3; //功能码 - uint16_t crc = crc16tablefast(ptr,len1); //CRC 校验 - if (crc != 0 ) return 4; //CRC 校验错误 + if (pPkg->Dst >127) return -2; //鍦板潃鐮� + if ((pPkg->Cmd&0x7f) > 0x1f) return -3; //鍔熻兘鐮� + uint16_t crc = crc16tablefast(ptr,len1); //CRC 鏍¢獙 + if (crc != 0 ) return 4; //CRC 鏍¢獙閿欒 return S_OK; } -- Gitblit v1.9.1