From 0fe6b074f3f3994d87af195f37e349a83e27882c Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期六, 10 十二月 2022 16:55:40 +0800 Subject: [PATCH] FP0 fix utf8 char --- 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