瀏覽代碼

V0.2.1.10,增加电压全部接收的数组标志,避免电压数据无效上传

LAPTOP-KB7QFH2U\ChenJie-PC 1 年之前
父節點
當前提交
e4c376cb51
共有 4 個文件被更改,包括 33 次插入12 次删除
  1. 13 8
      code/app/AppGlobalVar.c
  2. 2 1
      code/app/AppGlobalVar.h
  3. 17 2
      code/app/AppTaskCan.c
  4. 1 1
      code/app/AppTaskUart1.c

+ 13 - 8
code/app/AppGlobalVar.c

@@ -18,24 +18,28 @@
 
 #define defaultSn "ZLTEST00000000001"
 
-#define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
-#include "Eep_MemMap.h"
-AppConfigBody AppConfigInfo = {false, false, {defaultSn}, {0}};
-#define EEP_STOP_SEC_VAR_INIT_8_NO_CACHEABLE
-#include "Eep_MemMap.h"
-
 #define APP_RELEASE
 
 #ifdef APP_RELEASE
 const char WebSiteName[] = "\"iotp.fast-fun.cn\"";
 uint16 WebSitePort = 8712;
+#define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
+#include "Eep_MemMap.h"
+AppConfigBody AppConfigInfo = {false, false, {defaultSn}, {0}};
+#define EEP_STOP_SEC_VAR_INIT_8_NO_CACHEABLE
+#include "Eep_MemMap.h"
 #else
 const char WebSiteName[] = "\"nas.fast-fun.cn\"";
 uint16 WebSitePort = 8812;
+#define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
+#include "Eep_MemMap.h"
+AppConfigBody AppConfigInfo = {false, true, {defaultSn}, {0}};
+#define EEP_STOP_SEC_VAR_INIT_8_NO_CACHEABLE
+#include "Eep_MemMap.h"
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00020109;
+const uint32 AppSwVersion = 0x0002010A;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000002;
@@ -138,7 +142,8 @@ UINT8 BcuRxFlag[28];
 /************************************************************
  *BCU->4G解码变量存放区
  ************************************************************/
-UINT8 BMS_CellRecvCounter=0;						//每个电压收取标志位
+UINT8 BMS_CellRecvFlg = 0;						//电压收取标志位
+UINT8 canRecvFramNum[BMS_CELL_MAX_NUM/3] = {0};
 UINT8 BMS_ReqVIN = 0x00;						// 是否请求VIN码,0:预留;1:请求VIN;2:不请求VIN;3:无效;,Re-1,Off-0,
 UINT8 BMS_ReqHVOff = 0x00;						// 是否请求下高压,0:预留;1:请求下高压;2:不请求下高压;3:无效;,Re-1,Off-0,
 UINT8 BMS_ProtocolEditionH = 0x00;				// 通讯协议版本高位(例 : 版本为3 .1, 则此处发3),	, Re - 1, Off - 0,

+ 2 - 1
code/app/AppGlobalVar.h

@@ -121,7 +121,8 @@ extern BOOL BcuRxShortError[28];
 extern BOOL BcuRxLongError[28];
 extern UINT8 BcuRxErrorCounter[28];
 extern UINT8 BcuRxFlag[28];
-extern UINT8 BMS_CellRecvCounter;
+extern UINT8 BMS_CellRecvFlg;
+extern UINT8 canRecvFramNum[BMS_CELL_MAX_NUM/3];
 extern UINT8 BMS_ReqVIN;
 extern UINT8 BMS_ReqHVOff;
 extern UINT8 BMS_ProtocolEditionH;

+ 17 - 2
code/app/AppTaskCan.c

@@ -289,11 +289,25 @@ void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 			{
 				break;
 			}
-			BMS_CellRecvCounter = (BMS_CellRecvCounter + 1) >= battCellTotalTemp ? battCellTotalTemp : (BMS_CellRecvCounter + 1);
 			for (UINT8 i = 0; i < 3; i++)
 			{
 				BMS_CellVolt[(BMS_CellVoltFramNum - 1) * 3 + i] = (UINT16)(((*(UINT8 *)(rawData + i * 2 + 2)) | (*(UINT8 *)(rawData + i * 2 + 3) << 8)) & 0xFFFF);
 			}
+			canRecvFramNum[BMS_CellVoltFramNum - 1] = 1;
+			if(BMS_CellRecvFlg==false)
+			{
+				uint8 FrameSum = 0;
+				for(uint8 i=0;i<battCellTotalTemp;i++)
+				{
+					FrameSum = FrameSum + canRecvFramNum[i];
+				}
+				if(FrameSum==battCellTotalTemp)
+				{
+					BMS_CellRecvFlg = true;
+				}
+			}
+
+
 			BcuRxFlag[13] = 0x01;
 		}
 		break;
@@ -1160,7 +1174,8 @@ void BcuRxMsgSetInvalidValue(uint32 ID)
 		break;
 	case 0x18C1D0F3:
 		BMS_CellVoltFramNum = 0xFF;
-		BMS_CellRecvCounter = 0;
+		memset(canRecvFramNum,0x00,sizeof(canRecvFramNum));
+		BMS_CellRecvFlg = 0;
 		for (UINT16 i = 0; i < sizeof(BMS_CellVolt) / 2; i++)
 		{
 			BMS_CellVolt[i] = 0xFFFF;

+ 1 - 1
code/app/AppTaskUart1.c

@@ -1088,7 +1088,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 	}
 	case 0x91:
 	{
-		if(BMS_CellRecvCounter<min(BMS_CellTotal, BMS_CELL_MAX_NUM)/3)
+		if(BMS_CellRecvFlg==false)//CAN上电压数据未接收完成
 		{
 			*SendLen = 0; // 不发送,长度为0
 			return;