|
@@ -32,6 +32,7 @@ BIKESPDPI_IN bikespeed_stPIIn;
|
|
|
static BIKESPDPI_COF bikespeed_stPICof;
|
|
|
BIKESPDPI_OUT bikespeed_stPIOut;
|
|
|
LPF_OUT bike_pvt_stCurLpf;
|
|
|
+BIKESPDLIMIT_COEF bikespeed_stSpdLimCoef;
|
|
|
|
|
|
static ULONG bikespeed_pvt_FreqPu = 0;
|
|
|
/***************************************************************
|
|
@@ -63,6 +64,10 @@ void bikespeed_voBikeSpeedCof(void)
|
|
|
bikespeed_stFreGetCof.uwBikespeedPwrErrorVoltagePuUp = ((ULONG)BIKESPEED_POWER_ERROR_VOLTAGE_UP << 14) / VBASE;
|
|
|
bikespeed_stFreGetCof.uwWheelPerimeter = 600;
|
|
|
bikespeed_stFreGetCof.uwMinTriptoUpdate = 100; // 100m
|
|
|
+
|
|
|
+ bikespeed_stSpdLimCoef.uwBikeSpdThresHold1 = (ass_stParaCong.uwAssistMaxSpdKmH-2)*BIKESPEED_KMPERH2FREQPU;
|
|
|
+ bikespeed_stSpdLimCoef.uwBikeSpdThresHold2 = ass_stParaCong.uwAssistMaxSpdKmH*BIKESPEED_KMPERH2FREQPU;
|
|
|
+ bikespeed_stSpdLimCoef.ulBikeSpdDeltInv = ((SQWORD)1 << 20) / (bikespeed_stSpdLimCoef.uwBikeSpdThresHold2 - bikespeed_stSpdLimCoef.uwBikeSpdThresHold1); // Q20;
|
|
|
}
|
|
|
|
|
|
/***************************************************************
|
|
@@ -498,16 +503,16 @@ void bikespeed_voPI(const BIKESPDPI_IN *in, BIKESPDPI_OUT *out)
|
|
|
out->slIqRefPu = (SLONG)sqIqRefPu;
|
|
|
}
|
|
|
|
|
|
- if (in->slSpdFdkPu <= 33*BIKESPEED_KMPERH2FREQPU)
|
|
|
+ if (in->slSpdFdkPu <= bikespeed_stSpdLimCoef.uwBikeSpdThresHold1)
|
|
|
{
|
|
|
uwBikeSpeedGain = Q12_1; // Q12
|
|
|
|
|
|
}
|
|
|
- else if (in->slSpdFdkPu > 33*BIKESPEED_KMPERH2FREQPU && in->slSpdFdkPu <= 37*BIKESPEED_KMPERH2FREQPU)
|
|
|
+ else if (in->slSpdFdkPu > bikespeed_stSpdLimCoef.uwBikeSpdThresHold1 && in->slSpdFdkPu <= bikespeed_stSpdLimCoef.uwBikeSpdThresHold2)
|
|
|
{
|
|
|
uwBikeSpeedGain =
|
|
|
Q12_1 -
|
|
|
- ((((SQWORD)in->slSpdFdkPu - (SQWORD)33*BIKESPEED_KMPERH2FREQPU ) * (SQWORD)ass_stCurLimCoef.ulBikeSpdDeltInv) >> 9); // Q12
|
|
|
+ ((((SQWORD)in->slSpdFdkPu - (SQWORD)bikespeed_stSpdLimCoef.uwBikeSpdThresHold1 ) * (SQWORD)ass_stCurLimCoef.ulBikeSpdDeltInv) >> 8); // Q12
|
|
|
}
|
|
|
else
|
|
|
{
|