Przeglądaj źródła

变频传输测试完成,版本号为1.2.1.20

CHENJIE-PC\QiXiang_CHENJIE 3 lat temu
rodzic
commit
918e4058cc
5 zmienionych plików z 42 dodań i 15 usunięć
  1. 1 0
      inc/MainTask.h
  2. 4 4
      inc/TcpTask.h
  3. 3 3
      inc/app.h
  4. 3 2
      src/MainTask.c
  5. 31 6
      src/TcpTask.c

+ 1 - 0
inc/MainTask.h

@@ -11,6 +11,7 @@
 extern UINT32 Timer_count;//每100ms加1
 extern volatile bool Sleep_flag;//睡眠标志位
 extern AppNVMDataType AppNVMData;
+extern AppDataBody AppDataInfo;
 /*---------------------------------------------------------------------------*/
 #define PROC_MAIN_TASK_STACK_SIZE           (1024)
 typedef enum

+ 4 - 4
inc/TcpTask.h

@@ -19,11 +19,11 @@ extern UINT32 TcpService;
 #define APP_EVENT_QUEUE_SIZE    (10)
 
 
-// #define QX_TCP_IPADRRES				"47.97.127.222"
-// #define QX_TCP_PORT					8712
-/*---------------测试IP地址-----------------------------------*/
-#define QX_TCP_IPADRRES				"39.103.177.126"
+#define QX_TCP_IPADRRES				"47.97.127.222"
 #define QX_TCP_PORT					8712
+/*---------------测试IP地址-----------------------------------*/
+// #define QX_TCP_IPADRRES				"39.103.177.126"
+// #define QX_TCP_PORT					8712
 // #define QX_TCP_IPADRRES				"120.26.68.165"
 // #define QX_TCP_PORT					14319
 /*---------------测试IP地址END-----------------------------------*/

+ 3 - 3
inc/app.h

@@ -15,8 +15,8 @@ extern "C" {
 //全局定义声明区
 #define BMS_MANUFACTURE (1) //BMS制造商表示1-超力源,2-美顺
 #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
-#define BAT4830
-//#define BAT6060  电池型号变化需要更改
+//#define BAT4830
+#define BAT6060  电池型号变化需要更改
 #ifdef  BAT4830
     #define BATT_CELL_VOL_NUM  (14)
     #define BATT_TEMP_NUM  (3)
@@ -34,7 +34,7 @@ extern "C" {
 #define HWVERSION		    0x0102    //硬件主版本,现为V1.2板
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01040000     //驱动层版本号V1.4.0.0
-#define	APPSWVERSION		0x01020113     
+#define	APPSWVERSION		0x01020114     
 
 //--------------------------------------------------------------------------------
 

+ 3 - 2
src/MainTask.c

@@ -40,10 +40,11 @@ UINT32 Timer_count;//每100ms加1
 volatile bool Sleep_flag = false;//睡眠标志位
 extern UINT32 TcpService;
 extern UINT8 BattChrgEndFlag;
-AppNVMDataType AppNVMData;
-AppDataBody AppDataInfo;
 AppConfigHeader   AppConfigHr;   //4 bytes
+AppNVMDataType AppNVMData;
+
 AppDataHeader AppDataHr;
+AppDataBody AppDataInfo;
 //主线程堆栈声明区
 static StaticTask_t           gProcess_Main_Task_t;
 static UINT8                  gProcess_Main_TaskStack[PROC_MAIN_TASK_STACK_SIZE];

+ 31 - 6
src/TcpTask.c

@@ -40,6 +40,7 @@ extern osMutexId_t UartMutex;
 extern osMutexId_t GpsMutex;
 extern UINT8 GpsData[16];
 extern AppNVMDataType AppNVMData;
+extern AppDataBody AppDataInfo;
 extern QueueHandle_t UartWriteCmdHandle;
 
 //局部变量申请
@@ -231,8 +232,34 @@ static void TcpDataInfoAssembleSend()
     UINT8 TEMP_NUM=0;
     TEMP_NUM = BATT_TEMP_NUM+2;//TEMP_NUM为BMS温度总检测数量
     UINT16 DataLen;
-    if(send_counter%1==0)
-    //if(0)
+    UINT8 BattSendFreq;
+    UINT8 GpsSendFreq;
+    osMutexAcquire(UartMutex, osWaitForever);
+    if((UartReadMsg.data[(0x03+BATT_CELL_VOL_NUM)*2+1]&0x03)==0x00)
+    {
+        BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
+        GpsSendFreq = AppDataInfo.GpsChrgInfoSendFreq/5;
+    }
+    else if((UartReadMsg.data[(0x03+BATT_CELL_VOL_NUM)*2+1]&0x03)==0x01)
+    {
+        BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
+        GpsSendFreq = AppDataInfo.GpsDisChrgInfoSendFreq/5;
+    }
+    else if((UartReadMsg.data[(0x03+BATT_CELL_VOL_NUM)*2+1]&0x03)==0x02)
+    {
+        BattSendFreq = AppDataInfo.BmsChrgInfoSendFreq/5;
+        GpsSendFreq = AppDataInfo.GpsChrgInfoSendFreq/5;
+    }
+    else
+    {
+        BattSendFreq = 6;
+        GpsSendFreq = 6;
+    }     
+    #ifdef USING_PRINTF
+            printf("send_counter= %x,BattSendFreq= %x,GpsSendFreq= %x,UartReadMsg:%x\n",send_counter,BattSendFreq,GpsSendFreq,UartReadMsg.data[(0x03+BATT_CELL_VOL_NUM)*2+1]);
+    #endif
+    osMutexRelease(UartMutex); 
+    if(send_counter%BattSendFreq==0)
     {
         osStatus_t result = osMutexAcquire(UartMutex, osWaitForever);
         appGetSystemTimeUtcSync(&TimeStracture);
@@ -280,7 +307,7 @@ static void TcpDataInfoAssembleSend()
         }
         BattToTcpInfo.battInfo.battI[0] = Batt_current>>8;
 	    BattToTcpInfo.battInfo.battI[1] = Batt_current & 0xFF;
-        BattU =( (UartReadMsg.data[(0x18+BATT_CELL_VOL_NUM+TEMP_NUM)*2])<<8|(UartReadMsg.data[(0x18+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1]))/10;
+        BattU =( (UartReadMsg.data[(0x18+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+BATT_OTHER_TEMP_NUM)*2])<<8|(UartReadMsg.data[(0x18+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+BATT_OTHER_TEMP_NUM)*2+1]))/10;
         //电池内外电压保持一致
         BattToTcpInfo.battInfo.battLinkVol[0] = BattU >> 8;
 	    BattToTcpInfo.battInfo.battLinkVol[1] = BattU & 0xFF;
@@ -321,8 +348,7 @@ static void TcpDataInfoAssembleSend()
             printf("end V4! \n",len);
         #endif
     }
-    if(send_counter%6==0)
-    //if(0)
+    if(send_counter%GpsSendFreq==0)
     {
         osStatus_t result = osMutexAcquire(GpsMutex, osWaitForever);
         appGetSystemTimeUtcSync(&TimeStracture);
@@ -357,7 +383,6 @@ static void TcpDataInfoAssembleSend()
         }
     }
     if(send_counter==0)
-    //if(0)
     {
         CHAR iccid[20];
         CHAR imei[15];