|
@@ -41,7 +41,7 @@
|
|
|
#include "syspar.h"
|
|
|
#include "bikebrake.h"
|
|
|
#include "bikethrottle.h"
|
|
|
-
|
|
|
+#include "Customization.h"
|
|
|
/******************************
|
|
|
*
|
|
|
* Parameter
|
|
@@ -113,19 +113,27 @@ void Lidian2_OBCSetPara(void)
|
|
|
#endif
|
|
|
|
|
|
/*限速阈值更新*/
|
|
|
- if(MC_UpcInfo.stAssistInfo.uwAssistLimitBikeSpdStart != Lidian2_stOBC2MCInfo.ucSpeedLimiation)
|
|
|
+ if(Lidian2_stOBC2MCInfo.ucSpeedLimiation != (MC_UpcInfo.stAssistInfo.uwAssistLimitBikeSpdStart + MC_UpcInfo.stBikeInfo2.swDeltaBikeSpeedLimit))//有变化时更新
|
|
|
{
|
|
|
- MC_UpcInfo.stAssistInfo.uwAssistLimitBikeSpdStart = Lidian2_stOBC2MCInfo.ucSpeedLimiation;
|
|
|
- MC_UpcInfo.stAssistInfo.uwAssistLimitBikeSpdStop = Lidian2_stOBC2MCInfo.ucSpeedLimiation + 2;
|
|
|
- MC_UpcInfo.stBikeInfo.uwThrottleMaxSpdKmH = Lidian2_stOBC2MCInfo.ucSpeedLimiation;
|
|
|
- MC_UpcInfo.stBikeInfo.uwSaveFlg = 1;
|
|
|
- MC_UpcInfo.stAssistInfo.uwSaveFlg = 1;
|
|
|
- cp_stFlg.ParaSaveEEFlg = TRUE;
|
|
|
- cp_stFlg.ParaUpdateFlg = TRUE;
|
|
|
- cp_stFlg.ParaAInfoUpdateFlg = TRUE;
|
|
|
- cp_stFlg.ParaBikeInfoUpdateFlg = TRUE;
|
|
|
- cp_stFlg.ParaAssistUpdateFinishFlg = TRUE;
|
|
|
+ SWORD deltaSpeed = 0;
|
|
|
+ deltaSpeed = (Lidian2_stOBC2MCInfo.ucSpeedLimiation - MC_UpcInfo.stAssistInfo.uwAssistLimitBikeSpdStart);
|
|
|
+ if(deltaSpeed > 0)
|
|
|
+ {
|
|
|
+ deltaSpeed = 0;
|
|
|
+ }
|
|
|
+ if(deltaSpeed != MC_UpcInfo.stBikeInfo2.swDeltaBikeSpeedLimit)
|
|
|
+ {
|
|
|
+ MC_UpcInfo.stBikeInfo2.swDeltaBikeSpeedLimit = deltaSpeed;
|
|
|
+ ass_ParaCong.swDeltaBikeSpeedLimit = deltaSpeed;
|
|
|
+ MC_UpcInfo.stBikeInfo2.uwSaveFlg = TRUE;
|
|
|
+ cp_stFlg.ParaSaveEEFlg = TRUE;
|
|
|
+ cp_stFlg.ParaUpdateFlg = TRUE;
|
|
|
+ cp_stFlg.ParaBikeInfo2UpdateFlg = TRUE;
|
|
|
+ cp_stFlg.ParaAssistUpdateFinishFlg = TRUE;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ Lidian2_XinSiWeiLimitThrottleSpd(Lidian2_stOBC2MCInfo.uwThrottlePWM);
|
|
|
}
|
|
|
/***************************************************************
|
|
|
Function: SP_USART_DataProcess;
|
|
@@ -189,25 +197,26 @@ void Lidian2_USART_DataProcess(USART_Buf_TypeDef* ptUartTx, UBYTE* Data)
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
+ //0-OFF, 1<=GearSt<6:ECO, 6<=GearSt<9:NORM, 9<=GearSt<12:SPORT, 12<=GearSt<15:TURBO, 15==GearSt:SMART
|
|
|
if(MC_ControlCode.GearSt != MC_GearSt_WALK)
|
|
|
{
|
|
|
if(Lidian2_stOBC2MCInfo.ucGearSt == 15)
|
|
|
{
|
|
|
MC_ControlCode.GearSt = MC_GearSt_SMART;
|
|
|
}
|
|
|
- else if(Lidian2_stOBC2MCInfo.ucGearSt == 12)
|
|
|
+ else if(Lidian2_stOBC2MCInfo.ucGearSt >= 12)
|
|
|
{
|
|
|
MC_ControlCode.GearSt = MC_GearSt_Torque_TURBO;
|
|
|
}
|
|
|
- else if((Lidian2_stOBC2MCInfo.ucGearSt == 9)||(Lidian2_stOBC2MCInfo.ucGearSt == 10) )
|
|
|
+ else if(Lidian2_stOBC2MCInfo.ucGearSt >= 9)
|
|
|
{
|
|
|
MC_ControlCode.GearSt = MC_GearSt_Torque_SPORT;
|
|
|
}
|
|
|
- else if(Lidian2_stOBC2MCInfo.ucGearSt == 6)
|
|
|
+ else if(Lidian2_stOBC2MCInfo.ucGearSt >= 6)
|
|
|
{
|
|
|
MC_ControlCode.GearSt = MC_GearSt_Torque_NORM;
|
|
|
}
|
|
|
- else if((Lidian2_stOBC2MCInfo.ucGearSt == 3)||(Lidian2_stOBC2MCInfo.ucGearSt == 5))
|
|
|
+ else if(Lidian2_stOBC2MCInfo.ucGearSt >= 1)
|
|
|
{
|
|
|
MC_ControlCode.GearSt = MC_GearSt_Torque_ECO;
|
|
|
}
|
|
@@ -371,4 +380,14 @@ void Lidian2_USART_RxData_Process(USART_Buf_TypeDef* ptUartTx, UBYTE* buf, UWORD
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void Lidian2_XinSiWeiLimitThrottleSpd(UWORD speedPWM)
|
|
|
+{
|
|
|
+#if(HEYBIKEXINSIWEI_ENABLE == 1)
|
|
|
+
|
|
|
+ speedPWM = (speedPWM & 0xFF);//只取低字节
|
|
|
+ ass_stCadAssCoef.uwThrottleMaxBikeSpeed = (((ass_ParaCong.uwThrottleMaxSpdKmH+ass_ParaCong.swDeltaBikeSpeedLimit)<<4) + 8)*speedPWM/255;
|
|
|
+ ass_stCadAssCoef.swThrottleMaxspd = ass_stCadAssCoef.swKmhToMSpdPu*((SLONG) ass_stCadAssCoef.uwThrottleMaxBikeSpeed + ASS_SPD_LIMIT_ERR) >> 4;
|
|
|
+
|
|
|
+#endif
|
|
|
+}
|
|
|
/************************ (C) END OF FILE *********************************/
|