2 次代碼提交 3511a0e61b ... 7877e3ceb0

作者 SHA1 備註 提交日期
  LAPTOP-KB7QFH2U\ChenJie-PC 7877e3ceb0 Merge branch '4G_ZK_01B-Debug' of http://git.fast-fun.cn:92/RuiLiWuLian/4G into 4G_ZK_01B-Debug 1 年之前
  LAPTOP-KB7QFH2U\ChenJie-PC 0f4882d998 FOTA更新增加错误代码 1 年之前
共有 6 個文件被更改,包括 31 次插入17 次删除
  1. 4 4
      .settings/language.settings.xml
  2. 2 1
      code/app/AppGlobalVar.c
  3. 1 0
      code/app/AppGlobalVar.h
  4. 1 1
      code/app/AppTaskMain.c
  5. 19 7
      code/app/AppTaskUart1.c
  6. 4 4
      code/hal/Hal_Wdg.c

+ 4 - 4
.settings/language.settings.xml

@@ -5,7 +5,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-257754125827087661" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-161505450438682623" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>
@@ -16,7 +16,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-257754125827087661" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-161505450438682623" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>
@@ -27,7 +27,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-257754125827087661" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-161505450438682623" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>
@@ -38,7 +38,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-257754125827087661" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-161505450438682623" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>

+ 2 - 1
code/app/AppGlobalVar.c

@@ -35,7 +35,7 @@ uint16 WebSitePort = 8812;
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00020005;
+const uint32 AppSwVersion = 0x0002FF05;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000001;
@@ -50,6 +50,7 @@ uint16 ErrorArray[10] = {0};
 uint8 Fota_update_flag = 0;
 boolean Fota_Process_Going = false;
 uint8 Fota_error_flag = 0;
+uint8 DeviceErrNum = 0;
 /*GPS*/
 QueueHandle_t GpsDataQueueHandle;
 sint16 xyzData[3] = {0};

+ 1 - 0
code/app/AppGlobalVar.h

@@ -76,6 +76,7 @@ extern uint16 WebSitePort;
 extern char ImeiNum[15];
 extern char IccidNum[20];
 extern uint8 TcpWorkState;
+extern uint8 DeviceErrNum;
 typedef struct _AppEppType
 {
     uint32 battDischrgAccCap;

+ 1 - 1
code/app/AppTaskMain.c

@@ -41,7 +41,7 @@ void MainTask(void *pvParameters)
 			AppConfigInfo.appSaveFlg = false;
 			HAL_EEP_Write(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo));
 		}
-		if (Fota_update_flag || Fota_error_flag)
+		if (Fota_update_flag==1)
 		{
 			// 重启前保存数据
 			AppConfigInfo.appSaveFlg = false;

+ 19 - 7
code/app/AppTaskUart1.c

@@ -161,6 +161,11 @@ void Uart_4G_Task(void *pvParameters)
 					PROC_TCP_STATE_SWITCH(PROCESS_TCP_ERROR);
 				}
 			}
+			if(Fota_error_flag==1)
+			{
+				SocketId = -1;
+				PROC_TCP_STATE_SWITCH(PROCESS_TCP_ERROR);
+			}
 			break;
 		}
 		case PROCESS_TCP_RECV: // 网络数据接收,100ms空闲状态下即可接收
@@ -190,13 +195,14 @@ void Uart_4G_Task(void *pvParameters)
 		{
 			vTaskDelay(pdMS_TO_TICKS(1000));
 			tcpErrorCounter++;
-			if (tcpErrorCounter > 60 || TcpSysReboot == 1) // 无法驻网或者联网
+			if (tcpErrorCounter > 60 || TcpSysReboot == 1||Fota_error_flag == 1) // 无法驻网或者联网或者FTP失败
 			{
 				Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
 				vTaskDelay(pdMS_TO_TICKS(2500));
 				Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
 				vTaskDelay(pdMS_TO_TICKS(2500));
 				tcpErrorCounter = 0;
+				Fota_error_flag = 0;
 				PROC_TCP_STATE_SWITCH(PROCESS_TCP_INIT);
 			}
 			else
@@ -944,7 +950,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
 								%.2f,%.2f,%.2f,%.2f,%.2f,}\
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
-								%.2f,%.2f,%.2f,%.2f,%.2f,},%s",
+								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d",
 				returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
 				returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
 
@@ -952,7 +958,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 				returnP[1][0], returnP[1][1], returnP[1][2], returnP[1][3], returnP[1][4],
 
 				returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
-				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp);
+				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum);
 
 		BufferLen = strlen((const char *)rbuf);
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);
@@ -1085,8 +1091,8 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 		*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF);	   // uint8	minute
 		*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF);	   // uint8	second
 		*(SendBuffer + 0x25) = (CSQValue & 0xFF);			   // uint8	csq
-		*(SendBuffer + 0x26) = (BMS_Mode & 0xFF);			   // uint8	电池管理系统工作状态,0-初始化 1-自检完成允许上电 2-运行状态 3-高压切断 4-故障状态,精度_1,偏移量_0,单位_
-		*(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF);		   // uint8	直流充电枪连接状态,0-未连接 1-单枪连接 2-双枪连接 3-无效,精度_1,偏移量_0,单位_
+		*(SendBuffer + 0x26) = (BMS_Mode & 0xFF);			   // uint8	BMS当前状态,0:预留;1:高压上电;2:高压下电;3:无效;,Re-1,Off-0,
+		*(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF);		   // uint8	直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,
 		*(SendBuffer + 0x28) = (BMS_FtLvl & 0xFF);			   // uint8	当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
 		*(SendBuffer + 0x29) = (BMS_FtCode & 0xFF);			   // uint8	故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
 		*(SendBuffer + 0x2A) = (BMS_ReqHVOff & 0xFF);		   // uint8	BMS下高压请求,0-无效 1-请求下高压 2-不请求下高压 3-无效,精度_1,偏移量_0,单位_
@@ -1581,6 +1587,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			}
 			else
 			{
+				DeviceErrNum = 10;
 				ftp_EndFlg = 1;
 			}
 			break;
@@ -1597,6 +1604,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			}
 			else
 			{
+				DeviceErrNum = 11;
 				ftp_EndFlg = 1;
 			}
 			break;
@@ -1613,6 +1621,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			}
 			else
 			{
+				DeviceErrNum = 12;
 				ftp_EndFlg = 1;
 			}
 			break;
@@ -1629,6 +1638,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			}
 			else
 			{
+				DeviceErrNum = 13;
 				ftp_EndFlg = 1;
 			}
 			break;
@@ -1758,16 +1768,19 @@ void Fota_Ftp(uint8 *dataPtrIn)
 					if (getDataLenErrCount < 50 && Hal_FlsCheckIsTransferSucceed() == TRUE)
 					{
 						ftp_process++;
+						Fota_update_flag = 1;
 					}
 					else
 					{
 						ftp_process++;
+						DeviceErrNum = 15;
 					}
 				}
 			}
 			else
 			{
 				ftp_process++;
+				DeviceErrNum = 14;
 			}
 			break;
 		}
@@ -1777,7 +1790,6 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			sprintf(ATSendDataBuffer, "AT+FSDEL=*.*\r\n");
 			UART_Query_Data(UART_LPUART1, UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), UartRecvBuffer, &ReadLen, pdMS_TO_TICKS(5000));
 			ftp_process++;
-			Fota_update_flag = TRUE;
 			break;
 		}
 		default:
@@ -1785,7 +1797,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
 			break;
 		}
 	}
-	if (ftp_process < 6)
+	if (Fota_update_flag==0)
 	{
 		Fota_error_flag = 1;
 	}

+ 4 - 4
code/hal/Hal_Wdg.c

@@ -111,10 +111,10 @@ void DoResetECUWithWdg(void)
 {
 	IsFeedWdg = FALSE;
 	Wdg_43_Instance0_SetTriggerCondition(0);
-//	while(1)
-//	{
+	while(1)
+	{
 //		AppAddr resetHandle = (AppAddr)(0x00);
 //		    (resetHandle)();
-//		;
-//	}
+		;
+	}
 }