|
@@ -370,95 +370,102 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
}
|
|
|
|
|
|
|
|
|
- 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
|
|
|
{
|
|
|
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
|
|
|
{
|
|
|
MC_ErrorCode.ERROR_Bit.Protect_OverCurrent = 1;
|
|
|
+ cp_stHistoryPara.uwAlamSOcurTimes++;
|
|
|
/*error log updata*/
|
|
|
ErrorLog_Updata();
|
|
|
que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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
|
|
|
{
|
|
|
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
|
|
|
{
|
|
|
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
|
|
|
{
|
|
|
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)
|
|
|
+ if ((alm_unCode.bit.IPMOvrHeat == 1) && (MC_ErrorCode.ERROR_Bit.Protect_OverTemp == 0))
|
|
|
{
|
|
|
MC_ErrorCntRecord.Protect_OverTempCnt++;
|
|
|
- cp_stHistoryPara.uwAlamOHeatTimes++;
|
|
|
+
|
|
|
if (MC_ErrorCntRecord.Protect_OverTempCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
{
|
|
|
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)
|
|
|
{
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_PhaseLine = 1;
|
|
|
+ cp_stHistoryPara.uwAlamPhsLossTimes++;
|
|
|
/*error log updata*/
|
|
|
ErrorLog_Updata();
|
|
|
que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
@@ -470,54 +477,80 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
// cp_stHistoryPara.uwAlamComOTimeTimes++;
|
|
|
// }
|
|
|
|
|
|
- if (alm_unCode.bit.SpiThetaFlt == 1)
|
|
|
+ if ((alm_unCode.bit.SpiThetaFlt == 1) && (MC_ErrorCode.ERROR_Bit.Fault_SpiPosSensor == 0))
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_SpiPosSensor = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCntRecord.Fault_SpiPosSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_SpiPosSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
+ {
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_SpiPosSensor = 1;
|
|
|
+ cp_stHistoryPara.uwPosSensorAlamTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ 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))
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor = 1;
|
|
|
- /*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++;
|
|
|
- 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)
|
|
|
+ if ((alm_unBikeCode.bit.PCBNTC == 1) && (MC_ErrorCode.ERROR_Bit.Fault_PCBNTC == 0))
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_PCBNTC = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (alm_unBikeCode.bit.Throttle == 1)
|
|
|
+ if ((alm_unBikeCode.bit.Throttle == 1) && (MC_ErrorCode.ERROR_Bit.Fault_GasSensor == 0))
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_GasSensor = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ MC_ErrorCntRecord.Fault_GasSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_GasSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
+ {
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_GasSensor = 1;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ 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))
|
|
|
{
|
|
|
- MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 1;
|
|
|
- /*error log updata*/
|
|
|
- ErrorLog_Updata();
|
|
|
- que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
-
|
|
|
+ MC_ErrorCntRecord.Fault_TorqueSensorCnt++;
|
|
|
+ if (MC_ErrorCntRecord.Fault_TorqueSensorCnt == ALAM_DISPLAY_CNT_0LEVEL)
|
|
|
+ {
|
|
|
+ MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 1;
|
|
|
+ cp_stHistoryPara.uwTorSensorAlamTimes++;
|
|
|
+ /*error log updata*/
|
|
|
+ ErrorLog_Updata();
|
|
|
+ que_ubPushIn(&que_stFlashErrorLog, &que_stErrorLog, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
alm_blAlmSingleRecordDoneFlg = TRUE;
|
|
@@ -590,6 +623,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unCode.bit.SpiThetaFlt != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_SpiPosSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_SpiPosSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -598,6 +632,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.BikeSpdSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_SpeedSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_BikeSpdSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -606,6 +641,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.CadenceSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_CadenceSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_CadenceSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -614,6 +650,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.PCBNTC != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_NtcSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_PCBNTC = 0;
|
|
|
}
|
|
|
}
|
|
@@ -622,6 +659,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.Throttle != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_GasSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_GasSensor = 0;
|
|
|
}
|
|
|
}
|
|
@@ -630,6 +668,7 @@ void Can_voMC_Run_1ms(void) /* parasoft-suppress METRICS-28 "本项目圈复杂
|
|
|
{
|
|
|
if (alm_unBikeCode.bit.TorqSen != 1)
|
|
|
{
|
|
|
+ MC_ErrorCntRecord.Fault_TorqueSensorCnt = 0;
|
|
|
MC_ErrorCode.ERROR_Bit.Fault_TorqueSensor = 0;
|
|
|
}
|
|
|
}
|