From 69cbf8a2fe6c8735f234c7819af9112d72f24dc9 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期六, 13 九月 2025 10:39:42 +0800
Subject: [PATCH] 优化代码

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java
index d77f480..716538e 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/CommonV1.java
@@ -7,10 +7,12 @@
 
 
 public class CommonV1 {
+
+
 	/**
 	 * 妫�鏌ュご
 	 * @param bs 涓婅瀛楄妭鏁扮粍
-	 * @return [rt1->true:鏄湰鍗忚P206锛宖alse:涓嶆槸鏈崗璁�;  rt2->true:鏄按璧勬簮鍗忚锛宖alse:鏄崌绾у崗璁甝
+	 * @return [銆�0銆�->true:鏄湰鍗忚P206锛宖alse:涓嶆槸鏈崗璁�;  銆�1銆�->true:鏄按璧勬簮鍗忚锛宖alse:鏄崌绾у崗璁甝
 	 * @throws Exception  寮傚父
 	 */
 	public Boolean[] isThisProtocolHead(byte[] bs) throws Exception{
@@ -176,8 +178,9 @@
 				return "璁$畻CRC鏄�:" + crcCompute + "锛屼笂浼燙RC鏄�" + crcInBs ;
 			}
 		}else{
-			int crcCompute = (byte)new CRC16().CRC(bs, ProtocolConstantV206V1.ctrlIndex, bs.length - 3) ;
-			int crcInBs = ByteUtilUnsigned.bytes2Short_BE(bs, bs.length - 3) ;
+			short crcCompute = new CRC16().CRC(bs, 0, bs.length - 4) ;
+			short crcInBs = ByteUtil.bytes2Short_BE(bs,bs.length - 3) ;
+			//int crcInBs = ByteUtilUnsigned.bytes2Short_BE(bs, bs.length - 3) ;
 			if(crcCompute == crcInBs){
 				return null ;
 			}else{

--
Gitblit v1.8.0