From fbb8392d06677c8eccabe03ecf3feddd349175ce Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期一, 17 十月 2022 02:15:38 +0800 Subject: [PATCH] sovle conflict --- Src/ModbusRTU.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Src/ModbusRTU.c b/Src/ModbusRTU.c index bd939f3..ad0b02f 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