|
@@ -269,7 +269,7 @@ void Can_voInitMC_Run(void)
|
|
|
// flash_voErrorRead();
|
|
|
|
|
|
// MC版本信息初始化,Mode和SN从EEPROM读取
|
|
|
- strncpy(MC_VerInfo.HW_Version, (char *)"88K7000101V1 ", 16); //长度不超过16
|
|
|
+ strncpy(MC_VerInfo.HW_Version, (char *)"SC20100101V1 ", 16); //长度不超过16
|
|
|
|
|
|
// Software version
|
|
|
char chFwVersion[16]="V1r0r0_";
|
|
@@ -356,35 +356,37 @@ void Can_voMC_Run_1ms(void)
|
|
|
else
|
|
|
{}
|
|
|
//故障日志获取故障状态
|
|
|
- if (alm_blAlmOccrFlg == TRUE)
|
|
|
+ if ((alm_blAlmOccrFlg == TRUE) || (alm_blWarnOccrFlg == TRUE))
|
|
|
{
|
|
|
- if (alm_blAlmSingleRecordDoneFlg == FALSE)//
|
|
|
+// if (alm_blAlmSingleRecordDoneFlg == FALSE)//
|
|
|
{
|
|
|
- if (alm_unCode.bit.IPMFlt == 1) //硬件过流
|
|
|
+ if ((alm_unCode.bit.IPMFlt == 1) && (MC_ErrorCode.ERROR_Bit.Protect_OverCurrent == 0)) //硬件过流
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_OverCurrentCnt++;
|
|
|
- cp_stHistoryPara.uwAlamHOcurTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_OverCurrentCnt == ALAM_DISPLAY_CNT_0LEVEL) // ALAM_DISPLAY_CNT_2LEVEL
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_OverCurrent==0)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Protect_OverCurrent = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCode.ERROR_Bit.Protect_OverCurrent = 1;
|
|
|
+ cp_stHistoryPara.uwAlamHOcurTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (alm_unCode.bit.OvrCur == 1) //软件过流
|
|
|
+ if ((alm_unCode.bit.OvrCur == 1) && (MC_ErrorCode.ERROR_Bit.Protect_OverCurrent == 0))//软件过流
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_OverCurrentCnt++;
|
|
|
- cp_stHistoryPara.uwAlamSOcurTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_OverCurrentCnt == ALAM_DISPLAY_CNT_0LEVEL) // ALAM_DISPLAY_CNT_2LEVEL
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_OverCurrent==0)
|
|
|
{
|
|
|
MC_ErrorCode.ERROR_Bit.Protect_OverCurrent = 1;
|
|
|
+ cp_stHistoryPara.uwAlamSOcurTimes++;
|
|
|
/*error log updata*/
|
|
|
ErrorLog_Updata();
|
|
|
que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
@@ -392,85 +394,90 @@ void Can_voMC_Run_1ms(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (alm_unCode.bit.OvrVlt == 1) //过压
|
|
|
+ if ((alm_unCode.bit.OvrVlt == 1) && (MC_ErrorCode.ERROR_Bit.Protect_OverVoltage == 0))//过压
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_OverVoltageCnt++;
|
|
|
- cp_stHistoryPara.uwAlamOVolTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_OverVoltageCnt == ALAM_DISPLAY_CNT_0LEVEL) // ALAM_DISPLAY_CNT_2LEVEL
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_OverVoltage==0)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Protect_OverVoltage = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCode.ERROR_Bit.Protect_OverVoltage = 1;
|
|
|
+ cp_stHistoryPara.uwAlamOVolTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (alm_unCode.bit.UndrVlt == 1) //欠压
|
|
|
+ if ((alm_unCode.bit.UndrVlt == 1) && (MC_ErrorCode.ERROR_Bit.Protect_UnderVoltage == 0))//欠压
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_UnderVoltageCnt++;
|
|
|
- cp_stHistoryPara.uwAlamUVolTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_UnderVoltageCnt == ALAM_DISPLAY_CNT_0LEVEL) // ALAM_DISPLAY_CNT_2LEVEL
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_UnderVoltage==0)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Protect_UnderVoltage = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCode.ERROR_Bit.Protect_UnderVoltage = 1;
|
|
|
+ cp_stHistoryPara.uwAlamUVolTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (alm_unCode.bit.RotorLock == 1) //堵转
|
|
|
+ if ((alm_unCode.bit.RotorLock == 1) && (MC_ErrorCode.ERROR_Bit.Protect_LockRotor == 0))//堵转
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_LockRotorCnt++;
|
|
|
- cp_stHistoryPara.uwAlamRotorLockTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_LockRotorCnt == ALAM_DISPLAY_CNT_0LEVEL) // ALAM_DISPLAY_CNT_2LEVEL
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_LockRotor==0)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Protect_LockRotor = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCode.ERROR_Bit.Protect_LockRotor = 1;
|
|
|
+ cp_stHistoryPara.uwAlamRotorLockTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (alm_unCode.bit.IPMOvrHeat == 1)//PCB过热
|
|
|
+ if ((alm_unCode.bit.IPMOvrHeat == 1) && (MC_ErrorCode.ERROR_Bit.Protect_OverTemp == 0))//PCB过热
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_OverTempCnt++;
|
|
|
- cp_stHistoryPara.uwAlamOHeatTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_OverTempCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Protect_OverTemp==0)
|
|
|
{
|
|
|
MC_ErrorCode.ERROR_Bit.Protect_OverTemp = 1;
|
|
|
+ cp_stHistoryPara.uwAlamOHeatTimes++;
|
|
|
/*error log updata*/
|
|
|
ErrorLog_Updata();
|
|
|
que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (alm_unCode.bit.PhsLoss == 1) //缺相
|
|
|
+ if ((alm_unCode.bit.PhsLoss == 1) && (MC_ErrorCode.ERROR_Bit.Fault_PhaseLine == 0))//缺相
|
|
|
{
|
|
|
MC_ErrorCntRecord.Fault_PhaseLineCnt++;
|
|
|
- cp_stHistoryPara.uwAlamPhsLossTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Fault_PhaseLineCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
{
|
|
|
if(MC_ErrorCode.ERROR_Bit.Fault_PhaseLine==0)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_PhaseLine = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_PhaseLine = 1;
|
|
|
+ cp_stHistoryPara.uwAlamPhsLossTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
// if(alm_unCode.bit.CommOvrTm)
|
|
|
// {
|
|
@@ -485,39 +492,42 @@ void Can_voMC_Run_1ms(void)
|
|
|
// que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
// }
|
|
|
|
|
|
- if (alm_unBikeCode.bit.BikeSpdSen == 1) //速度传感器故障
|
|
|
+ if ((alm_unBikeCode.bit.BikeSpdSen == 1) && (MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor == 0))
|
|
|
{
|
|
|
- if(MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor==0)
|
|
|
- {
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor = 1;
|
|
|
- cp_stHistoryPara.uwBikeSpdSensorAlamTimes++;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
- }
|
|
|
+ MC_ErrorCntRecord.Fault_SpeedSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_SpeedSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
+ {
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor = 1;
|
|
|
+ cp_stHistoryPara.uwBikeSpdSensorAlamTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (alm_unBikeCode.bit.CadenceSen == 1) //踏频传感器故障
|
|
|
+ if ((alm_unBikeCode.bit.CadenceSen == 1) && (MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor == 0))
|
|
|
{
|
|
|
- cp_stHistoryPara.uwCadSensorAlamTimes++;
|
|
|
- if(MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor==0)
|
|
|
- {
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
- }
|
|
|
+ MC_ErrorCntRecord.Fault_CadenceSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_CadenceSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
+ {
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor = 1;
|
|
|
+ cp_stHistoryPara.uwCadSensorAlamTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (alm_unBikeCode.bit.PCBNTC == 1) //PCB温度
|
|
|
+ if ((alm_unBikeCode.bit.PCBNTC == 1) && (MC_ErrorCode.ERROR_Bit.Fault_PCBNTC == 0))
|
|
|
{
|
|
|
- if(MC_ErrorCode.ERROR_Bit.Fault_PCBNTC==0)
|
|
|
+ MC_ErrorCntRecord.Fault_NtcSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_NtcSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_PCBNTC = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
- }
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_PCBNTC = 1;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// if (alm_unBikeCode.bit.Throttle == 1) //油门故障
|
|
@@ -528,15 +538,16 @@ void Can_voMC_Run_1ms(void)
|
|
|
// que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
// }
|
|
|
|
|
|
- if (alm_unBikeCode.bit.TorqSen == 1) //力矩传感器故障
|
|
|
+ if ((alm_unBikeCode.bit.TorqSen == 1) && (MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor == 0))
|
|
|
{
|
|
|
- if(MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor==0)
|
|
|
+ MC_ErrorCntRecord.Fault_TorqueSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_TorqueSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 1;
|
|
|
- /*error log updata*/
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 1;
|
|
|
cp_stHistoryPara.uwTorSensorAlamTimes++;
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
}
|
|
|
}
|
|
|
// 电机霍尔故障
|
|
@@ -644,6 +655,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
// {
|
|
|
// if (alm_unCode.bit.SpiThetaFlt != 1)
|
|
|
// {
|
|
|
+// MC_ErrorCntRecord.Fault_SpiPosSensorCnt = 0;
|
|
|
// MC_ErrorCode.ERROR_Bit.Fault_SpiPosSensor = 0;
|
|
|
// }
|
|
|
// }
|
|
@@ -652,6 +664,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.BikeSpdSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_SpeedSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -660,6 +673,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.CadenceSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_CadenceSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -668,6 +682,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.PCBNTC != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_NtcSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_PCBNTC = 0;
|
|
|
}
|
|
|
}
|
|
@@ -676,6 +691,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.Throttle != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_GasSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_Throttle = 0;
|
|
|
}
|
|
|
}
|
|
@@ -684,6 +700,7 @@ void Can_voMC_Run_1ms(void)
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.TorqSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_TorqueSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 0;
|
|
|
}
|
|
|
}
|