|
@@ -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];
|