浏览代码

V0.2.0.8 GPS状态测试

LAPTOP-KB7QFH2U\ChenJie-PC 1 年之前
父节点
当前提交
64c98ee242
共有 3 个文件被更改,包括 15 次插入11 次删除
  1. 1 1
      code/app/AppGlobalVar.c
  2. 11 7
      code/app/AppTaskGps.c
  3. 3 3
      code/app/AppTaskUart1.c

+ 1 - 1
code/app/AppGlobalVar.c

@@ -39,7 +39,7 @@ AppConfigBody AppConfigInfo = {false, true, {defaultSn}, {0}};
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00020007;
+const uint32 AppSwVersion = 0x00020008;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000002;

+ 11 - 7
code/app/AppTaskGps.c

@@ -16,6 +16,8 @@ uint8 GpsRecvPtr[1024];
 uint32 timerCounterGetdata = 0;
 uint32 ledCounterTmp = 0;
 uint32 triaxiCounterTmp = 0;
+
+char gpsTestBuffer[20];
 static void vtimerCallback(TimerHandle_t pxTimer)
 {
 	uint32 ulTimerID;
@@ -40,7 +42,7 @@ void GpsTask(void *pvParameters)
 	uint8 fftIdx = 0;
 	uint16 GpsErrCounter = 0;
 	uint16 GpsRestartCounter = 0;
-	bool GpsPwrDownFlg = false;
+	volatile bool GpsPwrDownFlg = false;
 	while(1)
 	{
 		memset(GpsRecvPtr,0,sizeof(GpsRecvPtr));
@@ -57,6 +59,7 @@ void GpsTask(void *pvParameters)
 			}
 			else
 			{
+				GpsErrCounter+=1;
 				if(GpsErrCounter>60*10)
 				{
 					Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_OFF);//GPS关机
@@ -64,13 +67,13 @@ void GpsTask(void *pvParameters)
 					GpsPwrDownFlg = true;
 					GpsRestartCounter = 0;
 				}
-				if(GpsPwrDownFlg)
-				{
-					GpsRestartCounter+=1;
-				}
-				GpsErrCounter+=1;
 			}
-			if(GpsRestartCounter>10)
+
+			if(GpsPwrDownFlg)
+			{
+				GpsRestartCounter+=1;
+			}
+			if(GpsRestartCounter>30)
 			{
 				GpsRestartCounter = 0;
 				GpsPwrDownFlg = false;
@@ -137,6 +140,7 @@ void GpsDataDecode(uint8 *msg)
 	p2 = strtok(NULL, delim);
 	p = strtok(p, ","); //只取第1行的信息RMC
 //	p = strtok(temp,",");//模拟测试
+	memcpy(gpsTestBuffer,msg,19);
 	if (strcmp(p, "$GNRMC") == 0)
 	{
 		index = 0;

+ 3 - 3
code/app/AppTaskUart1.c

@@ -966,6 +966,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 	}
 	case DebugMsg:
 	{
+		extern char gpsTestBuffer[20];
 		char rbuf[512]={0};
 		char tmp[13] = {0};
 		memcpy(tmp,BMS_SN,12);
@@ -977,7 +978,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,%d-M-%d,P-%d,N-%d,C-%d,A-%d",
+								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d,%s",
 				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],
 
@@ -985,8 +986,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,DeviceErrNum,
-				BMS_Mode,BMS_StPosRly,BMS_StNegRly,BMS_CharSt,BMS_PackCurr-10000);
+				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum,gpsTestBuffer);
 
 		BufferLen = strlen((const char *)rbuf);
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);