|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
/*三轴计算*/
|