From 164ba745a3e54514f8c7bee517fc54317689f3f4 Mon Sep 17 00:00:00 2001 From: xin Date: Mon, 31 Mar 2025 13:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9E=E7=BB=AD=E9=87=87?= =?UTF-8?q?=E9=9B=86=E6=97=B6=E6=B2=A1=E6=9C=89=E6=97=B6=E9=97=B4=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E5=AF=BC=E8=87=B4=E9=80=9A=E8=AE=AF=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E4=BB=8E=E8=80=8C=E5=AF=BC=E8=87=B4=E6=97=A0=E6=9C=89=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=BF=9E=E7=BB=AD=E9=87=87=E9=9B=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E6=94=B9=E5=A6=82=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Communication_Protocol.h | 16 ++++++++++++++++ src/{IRIS_Method.c => IRIS_Method.cpp} | 3 +++ src/IRIS_Method.h | 5 +++-- 3 files changed, 22 insertions(+), 2 deletions(-) rename src/{IRIS_Method.c => IRIS_Method.cpp} (98%) diff --git a/src/Communication_Protocol.h b/src/Communication_Protocol.h index 9965c8e..4287249 100644 --- a/src/Communication_Protocol.h +++ b/src/Communication_Protocol.h @@ -11,6 +11,22 @@ // #define MYCOMAN 0x02 //命令全大写 // todo : define your protocol here /*-------------------------------------------------------------------------------------------------------------*/ +#define GET_BASIC_INFO 0x50 +#define SET_INTEGRAL_TIME 0x51 +#define SET_AUTO_EXPOSURE 0x52 +#define GET_INTEGRAL_TIME_AND_DATA_PROCESS 0x53 +#define GET_TEMPRETURE 0x54 +#define SET_SHUTTER_OPEN 0x55 +#define SET_SHUTTER_CLOSE 0x56 +#define GET_BANDNUMBER 0x57 +#define SET_WEAVE_COEFF 0x58 +#define GET_WEAVE_COEFF 0x59 +#define SET_DATA_PROCESS_METHOD 0x60 +#define GET_DATA_FROM_SENSOR 0x61 + + + +#define NONE_DATA 0x00 diff --git a/src/IRIS_Method.c b/src/IRIS_Method.cpp similarity index 98% rename from src/IRIS_Method.c rename to src/IRIS_Method.cpp index 9c1412f..3c4b8b8 100644 --- a/src/IRIS_Method.c +++ b/src/IRIS_Method.cpp @@ -104,6 +104,9 @@ int32_t IRIS_Cut_Befor_Header(uint8_t *PackData, uint16_t LenthofIn) { if (PackData == NULL) { return ERROR_INPUT; } + if (LenthofIn <2) { + return LenthofIn; + } uint16_t i = 0; for (i = 0; i < LenthofIn; i++) { if (PackData[i] == 0x55 && PackData[i + 1] == 0xAA) { diff --git a/src/IRIS_Method.h b/src/IRIS_Method.h index cfbf7c9..e69852d 100644 --- a/src/IRIS_Method.h +++ b/src/IRIS_Method.h @@ -1,5 +1,5 @@ /** - ****************************************************************************** +****************************************************************************** * @file : IRIS_Method.h * @author : xin * @brief : None @@ -20,7 +20,8 @@ #define ERROR_COMMAND -400 #define ERROR_INPUT -500 #define ERROR_CRC -600 - +#include +//#include // 成功返回打包后的数据长度 // -1: Error