LAPTOP-KB7QFH2U\ChenJie-PC il y a 1 an
Parent
commit
bd1c142977
2 fichiers modifiés avec 38 ajouts et 6 suppressions
  1. 1 1
      code/app/AppGlobalVar.c
  2. 37 5
      code/app/AppTaskGps.c

+ 1 - 1
code/app/AppGlobalVar.c

@@ -16,7 +16,7 @@
 
 #include "AppGlobalVar.h"
 
-#define defaultSn "GYTEST00000000001"
+#define defaultSn "ZLTEST00000000001"
 
 #define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
 #include "Eep_MemMap.h"

+ 37 - 5
code/app/AppTaskGps.c

@@ -38,6 +38,9 @@ void GpsTask(void *pvParameters)
 	real_T S1[SIZE_FFT];
 	real_T S2[SIZE_FFT];
 	uint8 fftIdx = 0;
+	uint16 GpsErrCounter = 0;
+	uint16 GpsRestartCounter = 0;
+	bool GpsPwrDownFlg = false;
 	while(1)
 	{
 		memset(GpsRecvPtr,0,sizeof(GpsRecvPtr));
@@ -46,26 +49,55 @@ void GpsTask(void *pvParameters)
 		{
 			GpsDataDecode(GpsRecvPtr);
 		}
+		if(TimerCounter%1000==0)
+		{
+			if(DeviceSpeed>0)//GPS定位成功
+			{
+				GpsErrCounter = 0;
+			}
+			else
+			{
+				if(GpsErrCounter>60*10)
+				{
+					Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_OFF);//GPS关机
+					GpsErrCounter = 0;
+					GpsPwrDownFlg = true;
+					GpsRestartCounter = 0;
+				}
+				if(GpsPwrDownFlg)
+				{
+					GpsRestartCounter+=1;
+				}
+				GpsErrCounter+=1;
+			}
+			if(GpsRestartCounter>10)
+			{
+				GpsRestartCounter = 0;
+				GpsPwrDownFlg = false;
+				Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_ON);//GPS开机
+			}
+		}
 		/*LED控制*/
 		if((timerCounterGetdata - ledCounterTmp) > 200)
 		{
-			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(LED_INDEX2, STD_OFF);
 			ledCounterTmp = timerCounterGetdata;
 			if(SocketId>=0)//网络连接成功
 			{
-				Dio_FlipChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2);
+				Dio_FlipChannel(LED_INDEX3);
 			}
 			else
 			{
-				Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2,STD_OFF);
+				Dio_WriteChannel(LED_INDEX3,STD_OFF);
 			}
 			if(DeviceSpeed>0)//GPS定位成功
 			{
-				Dio_FlipChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3);
+				Dio_FlipChannel(LED_INDEX4);
+				GpsErrCounter = 0;
 			}
 			else
 			{
-				Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3,STD_OFF);
+				Dio_WriteChannel(LED_INDEX4,STD_OFF);
 			}
 		}
 		/*三轴计算*/