|
@@ -690,17 +690,26 @@ void LEDDisplay(void)
|
|
|
if(LightTimer<(UINT8)(LEDFlashPeriod*DutyRatio))
|
|
|
{
|
|
|
NetSocDisplay(LED_SOC_0,LED_TURN_ON);
|
|
|
+ NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
|
|
|
FaultDisplay(LED_TURN_ON);
|
|
|
}
|
|
|
else if(LightTimer>=(UINT8)(LEDFlashPeriod*DutyRatio) && LightTimer<LEDFlashPeriod)
|
|
|
{
|
|
|
NetSocDisplay(LED_SOC_0,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
|
|
|
FaultDisplay(LED_TURN_OFF);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
NetSocDisplay(LED_SOC_0,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
|
|
|
+ NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
|
|
|
FaultDisplay(LED_TURN_OFF);
|
|
|
LightTimer = 0;
|
|
|
}
|
|
@@ -930,20 +939,20 @@ BOOL uartBattInfoDecode(UINT8* dataPtr)
|
|
|
UINT32 Battsumvoltage = 0;
|
|
|
BATT_CELL_VOL_NUM = (dataPtr[(0x00)*2] << 8) | (dataPtr[(0x00)*2 + 1]);
|
|
|
BATT_TEMP_NUM = ((dataPtr[(0x01)*2] << 8) | (dataPtr[(0x01)*2 + 1]))-BMS_OTHER_TEMP;
|
|
|
- if((AppNVMData.BattCellCount!=BATT_CELL_VOL_NUM || AppNVMData.BattTempCount!=BATT_TEMP_NUM) &&(BATT_CELL_VOL_NUM !=0 ) && (BATT_TEMP_NUM!=0) )
|
|
|
+ if((AppDataInfo.BattCellCount!=BATT_CELL_VOL_NUM || AppDataInfo.BattTempCount!=BATT_TEMP_NUM) &&(BATT_CELL_VOL_NUM !=0 ) && (BATT_TEMP_NUM!=0) )
|
|
|
{
|
|
|
- AppNVMData.appDataModify = TRUE;
|
|
|
- AppNVMData.BattCellCount = BATT_CELL_VOL_NUM;
|
|
|
- AppNVMData.BattTempCount = BATT_TEMP_NUM;
|
|
|
+ AppDataInfo.appDataModify = TRUE;
|
|
|
+ AppDataInfo.BattCellCount = BATT_CELL_VOL_NUM;
|
|
|
+ AppDataInfo.BattTempCount = BATT_TEMP_NUM;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- BATT_CELL_VOL_NUM = AppNVMData.BattCellCount;
|
|
|
- BATT_TEMP_NUM = AppNVMData.BattTempCount;
|
|
|
+ BATT_CELL_VOL_NUM = AppDataInfo.BattCellCount;
|
|
|
+ BATT_TEMP_NUM = AppDataInfo.BattTempCount;
|
|
|
}
|
|
|
#ifdef USING_PRINTF1
|
|
|
- printf("BattCellCount:%d,BATT_CELL_VOL_NUM:%d ",AppNVMData.BattCellCount,BATT_CELL_VOL_NUM);
|
|
|
- printf("BattTempCount:%d,BATT_TEMP_NUM:%d ",AppNVMData.BattTempCount,BATT_TEMP_NUM);
|
|
|
+ printf("BattCellCount:%d,BATT_CELL_VOL_NUM:%d ",AppDataInfo.BattCellCount,BATT_CELL_VOL_NUM);
|
|
|
+ printf("BattTempCount:%d,BATT_TEMP_NUM:%d ",AppDataInfo.BattTempCount,BATT_TEMP_NUM);
|
|
|
#endif
|
|
|
for(i=0;i<BATT_CELL_VOL_NUM;i++)
|
|
|
{
|
|
@@ -1002,12 +1011,6 @@ BOOL uartBattInfoDecode(UINT8* dataPtr)
|
|
|
bmsHwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1];
|
|
|
bmsSwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2];
|
|
|
|
|
|
- if(AppNVMData.BmsHwVersion!=bmsHwVersion || AppNVMData.BmsSwVersion!=bmsSwVersion )
|
|
|
- {
|
|
|
- AppNVMData.appDataModify = TRUE;
|
|
|
- AppNVMData.BmsHwVersion = bmsHwVersion;
|
|
|
- AppNVMData.BmsSwVersion = bmsSwVersion;
|
|
|
- }
|
|
|
#ifdef USING_PRINTF1
|
|
|
printf("[%d]-%x\n",__LINE__,(dataPtr[(0x09+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1]));
|
|
|
printf("[%d]-%x\n",__LINE__,(dataPtr[(0x1B+BATT_CELL_VOL_NUM+TEMP_NUM)*2]));
|
|
@@ -1327,6 +1330,7 @@ void SaveAppConfig(void)
|
|
|
/*
|
|
|
* open the NVM file
|
|
|
*/
|
|
|
+ AppNVMData.appDataModify = FALSE;
|
|
|
fp = OsaFopen(APP_CONFIG_FILE_NAME, "wb"); //read & write
|
|
|
if(OsaFseek(fp, 0, SEEK_SET) != 0)
|
|
|
{
|
|
@@ -1360,7 +1364,6 @@ void SaveAppConfig(void)
|
|
|
/*
|
|
|
* write the file body
|
|
|
*/
|
|
|
- AppNVMData.appDataModify = FALSE;
|
|
|
writeCount = OsaFwrite(&AppNVMData, sizeof(AppNVMData), 1, fp);
|
|
|
if (writeCount != 1)
|
|
|
{
|
|
@@ -1391,9 +1394,9 @@ void LoadAppConfig(void)
|
|
|
|
|
|
if (fp == PNULL)
|
|
|
{
|
|
|
- #ifdef USING_PRINTF
|
|
|
- printf(" NVM, can't open NVM: 'qxappConfig.nvm', use the defult value\n");
|
|
|
- #endif
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf(" NVM, can't open NVM: 'qxappConfig.nvm', use the defult value\n");
|
|
|
+ #endif
|
|
|
setDefaultAppConfigData();
|
|
|
SaveAppConfig();
|
|
|
return;
|
|
@@ -1470,15 +1473,15 @@ static void setDefaultAppConfigData(void)
|
|
|
memset(&AppNVMData, 0x00, sizeof(AppConfigDataType));
|
|
|
AppNVMData.appDataModify = TRUE; //数据更改标志位
|
|
|
memcpy(AppNVMData.battSN,DEFAULT_SN,BATT_SN_LEN);
|
|
|
- AppNVMData.isBattLocked = 0; //0:not locked; 1:locked
|
|
|
- AppNVMData.chargEndWorkTime = 30; //
|
|
|
- AppNVMData.BattTempCount = 5; //电池温度个数
|
|
|
- AppNVMData.BattCellCount = 17; //电池电压串数
|
|
|
- AppNVMData.BmsHwVersion = 0;
|
|
|
- AppNVMData.BmsSwVersion = 0;
|
|
|
- AppNVMData.BLSwVersion = BLSWVERSION;
|
|
|
- AppNVMData.DrvSwVersion = DRVSWVERSION;
|
|
|
- AppNVMData.AppSwVersion = APPSWVERSION; //APP软件版本
|
|
|
+ AppNVMData.isBattLocked = 0;
|
|
|
+ AppNVMData.reserved1 = 0;
|
|
|
+ AppNVMData.reserved2 = 0;
|
|
|
+ AppNVMData.reserved3 = 0;
|
|
|
+ AppNVMData.reserved4 = 0;
|
|
|
+ AppNVMData.reserved5 = 0;
|
|
|
+ AppNVMData.reserved6 = 0;
|
|
|
+ AppNVMData.reserved7 = 0;
|
|
|
+ AppNVMData.reserved8 = 0;
|
|
|
AppNVMData.EOLState = EOLSTATE;
|
|
|
return;
|
|
|
}
|
|
@@ -1493,6 +1496,8 @@ static void setDefaultAppDataInfo(void)
|
|
|
{
|
|
|
memset(&AppDataInfo, 0x00, sizeof(AppDataInfo));
|
|
|
AppDataInfo.appDataModify = false;
|
|
|
+ AppDataInfo.BattCellCount = 17;
|
|
|
+ AppDataInfo.BattTempCount = 5;
|
|
|
AppDataInfo.BattInfoSendFreqHigh = 10;
|
|
|
AppDataInfo.BattInfoSendFreqNomal = 30;
|
|
|
AppDataInfo.BattInfoSendFreqLow = 60;
|
|
@@ -2305,7 +2310,7 @@ void UDS_Service(CAN_Msg_Type* CanRxMsg)
|
|
|
{
|
|
|
UDSPositiveAnswer(0x04,i,0x00);
|
|
|
osDelay(100);
|
|
|
- SaveAppConfig();
|
|
|
+ //SaveAppConfig();
|
|
|
appSetCFUN(0);
|
|
|
osDelay(1000);
|
|
|
EC_SystemReset();
|