Explorar el Código

版本号为:2.1.0.3,累计里程测试。

CHENJIE-PC\QiXiang_CHENJIE hace 3 años
padre
commit
0301d821b3
Se han modificado 4 ficheros con 19 adiciones y 5 borrados
  1. 3 2
      inc/app.h
  2. 11 0
      src/GpsTask.c
  3. 3 1
      src/MainTask.c
  4. 2 2
      src/UartTask.c

+ 3 - 2
inc/app.h

@@ -45,8 +45,8 @@ extern "C" {
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01050000     //驱动层版本号V1.4.0.0  驱动层1.5.0.0,增加了三轴
 //#define	APPSWVERSION		0x01020209     
- //#define	APPSWVERSION		0x02000100
- #define	APPSWVERSION		0x02010002
+//#define	APPSWVERSION		0x02000101
+#define	APPSWVERSION		0x02010003
 //--------------------------------------------------------------------------------
 
 #define APP_CONFIG_FILE_LATEST_VERSION 0
@@ -101,6 +101,7 @@ typedef struct AppDataType
     UINT8  GpsDisChrgInfoSendFreq;
     INT8  BattCurrentNegFlag;
     UINT32 CumulativeCapacity;
+    UINT32 AccMileage;
 }AppDataBody;
 typedef struct _AppDataHeader
 {

+ 11 - 0
src/GpsTask.c

@@ -31,6 +31,7 @@
 #include "TcpTask.h"
 //全局变量区输入
 extern volatile BOOL Sleep_flag; 
+extern AppDataBody AppDataInfo;
 //全局变量区输出
 UINT8 GpsData[16];
 osMutexId_t GpsMutex = NULL;
@@ -120,6 +121,16 @@ static void GpsTask(void* arg)
                         GpsData[2] = 0xff;
                         GpsData[3] = 0xfe;
                     }
+                    if(speedtemp>=1)
+                    {
+                        AppDataInfo.appDataModify = true;
+                        AppDataInfo.AccMileage = speedtemp/36 + AppDataInfo.AccMileage;
+                        if(AppDataInfo.AccMileage>=0xfffffffe)
+                        {
+                            AppDataInfo.AccMileage = 0;
+                        }
+
+                    }
                 }
             }
         osMutexRelease(GpsMutex);

+ 3 - 1
src/MainTask.c

@@ -110,7 +110,7 @@ static void MainTask(void* arg)
         printf("Wakeup_source:%d \n",Wakeup_source);
     #endif
     #ifdef DEBUGLOG
-    Debug_printf("Wakeup-%d \n",Wakeup_source);
+    Debug_printf("Wkp-%d \n",Wakeup_source);
     #endif
 	appGetNVMSavedData();
     LoadAppDataInfo();
@@ -275,6 +275,7 @@ static void MainTask(void* arg)
                     printf("which slpstate can go now :%d \n",slpstate);
                 #endif
                 #ifdef DEBUGLOG
+                    Debug_printf("AccM-%d  \n",AppDataInfo.AccMileage);
                     Debug_printf("slp-%d  \n",slpstate);
                 #endif
                 slpManDeepSlpTimerStart(deepslpTimerID, AppNVMData.sleepTime*1000*60);
@@ -787,6 +788,7 @@ static void setDefaultAppDataInfo(void)
     AppDataInfo.GpsDisChrgInfoSendFreq = 5;
     AppDataInfo.BattCurrentNegFlag = 1;
     AppDataInfo.CumulativeCapacity = 0;
+    AppDataInfo.AccMileage = 0;
     return;
 }
 

+ 2 - 2
src/UartTask.c

@@ -178,7 +178,7 @@ static void UartTask(void* arg)
 				{
 					PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_UPDATE);
 				}
-				if(AppNVMData.isBattLocked==TRUE && ((UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1])>>1)&0x03!=0x00 && Timer_count%10==0)
+				if(AppNVMData.isBattLocked==TRUE && ((UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1])>>1)&0x03!=0x00 && Timer_count%10==0)//try to lock
 				{
 					UartWriteData.WriteCmd = 0x01;
 					UartWriteData.Data[0] = 0x00;
@@ -186,7 +186,7 @@ static void UartTask(void* arg)
 					osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,1000);
 					PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_READ);
 				}
-				else if (AppNVMData.isBattLocked==FALSE && ((UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1])>>1)&0x03==0x00 && Timer_count%10==0 )
+				else if (AppNVMData.isBattLocked==FALSE && ((UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1])>>1)&0x03==0x00 && Timer_count%10==0 ) // try to unlock
 				{
 					UartWriteData.WriteCmd = 0x01;
 					UartWriteData.Data[0] = 0x00;