|
@@ -91,7 +91,7 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
}
|
|
|
case 0x1308://关机指令
|
|
|
{
|
|
|
- PowerOff_Process();
|
|
|
+ PowerOff_Process(FALSE);
|
|
|
break;
|
|
|
}
|
|
|
case 0x1410://电池设计信息
|
|
@@ -131,7 +131,7 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
//PBU广播的指令
|
|
|
case 0x1008://PBU关机指令
|
|
|
{
|
|
|
- PowerOff_Process();
|
|
|
+ PowerOff_Process(FALSE);
|
|
|
break;
|
|
|
}
|
|
|
case 0x120C://PBU物理ID
|
|
@@ -189,6 +189,14 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
case 0x3408://OBC设置用户参数
|
|
|
{
|
|
|
MC_ConfigParam1.WheelSizeAdj = (int8_t)Data[0];
|
|
|
+ if(MC_ConfigParam1.WheelSizeAdj > 10)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSizeAdj = 10;
|
|
|
+ }
|
|
|
+ if(MC_ConfigParam1.WheelSizeAdj < -10)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSizeAdj = -10;
|
|
|
+ }
|
|
|
MC_ConfigParam1.StarModel = (MC_StarMode_Struct_t)Data[1];
|
|
|
IsFlashSaveDataUpdate = TRUE;
|
|
|
SendData(ID_MC_TO_PBU, MODE_REPORT, 0x5303, (uint8_t*)"ACK");
|
|
@@ -241,7 +249,23 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
case 0x3810://ECU设置用户参数
|
|
|
{
|
|
|
MC_ConfigParam1.WheelSize = Data[0];
|
|
|
+ if(MC_ConfigParam1.WheelSize > 250)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSize = 250;
|
|
|
+ }
|
|
|
+ if(MC_ConfigParam1.WheelSize < 120)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSize = 120;
|
|
|
+ }
|
|
|
MC_ConfigParam1.SpeedLimit = Data[1];
|
|
|
+ if(MC_ConfigParam1.SpeedLimit > 99)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.SpeedLimit = 99;
|
|
|
+ }
|
|
|
+ if(MC_ConfigParam1.SpeedLimit < 5)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.SpeedLimit = 5;
|
|
|
+ }
|
|
|
//Data[2]和Data[3]低压保护值暂不处理
|
|
|
SaveParamToEEprom_24C02(&I2C_Handle_EEPROM, EEPROM_24C02_ADDR_CONFIG_PARAM1, sizeof(MC_ConfigParam1), (uint8_t*)&MC_ConfigParam1.GasCtrlMode_Flag);
|
|
|
SendData(ID_MC_TO_PBU, MODE_REPORT, 0x5303, (uint8_t*)"ACK");
|
|
@@ -308,6 +332,14 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
case 0x3208://设置电机配置参数
|
|
|
{
|
|
|
MC_ConfigParam1.WheelSizeAdj = (int8_t)Data[0];
|
|
|
+ if(MC_ConfigParam1.WheelSizeAdj > 10)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSizeAdj = 10;
|
|
|
+ }
|
|
|
+ if(MC_ConfigParam1.WheelSizeAdj < -10)
|
|
|
+ {
|
|
|
+ MC_ConfigParam1.WheelSizeAdj = -10;
|
|
|
+ }
|
|
|
MC_ConfigParam1.StarModel = (MC_StarMode_Struct_t)Data[1];
|
|
|
IsFlashSaveDataUpdate = TRUE;
|
|
|
SendData(ID_MC_TO_HMI, MODE_REPORT, 0x7403, (uint8_t*)"ACK");
|
|
@@ -506,7 +538,7 @@ void DataProcess(uint16_t ID, uint8_t Mode, uint16_t Cmd, uint8_t* Data)
|
|
|
if(strncmp("RESET", (char*)Data, DataLength) == 0)
|
|
|
{
|
|
|
SendData(ID_MC_TO_CDL, MODE_REPORT, 0xA903, (uint8_t*)"ACK");
|
|
|
- PowerOff_Process();
|
|
|
+ PowerOff_Process(TRUE);
|
|
|
HAL_Delay(100);
|
|
|
__set_FAULTMASK(1);//关闭所有中断
|
|
|
HAL_NVIC_SystemReset();
|