|
@@ -743,8 +743,29 @@ void Can_voMC_Run_1ms(void)
|
|
|
|
|
|
void Can_voMC_Run_5ms(void)
|
|
|
{
|
|
|
- cp_stBikeRunInfoPara.BikeSpeedKmH =
|
|
|
- (((SQWORD)bikespeed_stFreGetOut.uwFrequencyPu * FBASE * (ass_ParaCong.uwWheelPerimeter + ass_ParaCong.swDeltPerimeter) * 36 >> 20) * 1048 * 10) >>20; // 1048 = Q20(1/1000) 0.1 km/h
|
|
|
+ if(bikespeed_stFreGetCof.uwNumbersPulses == 0) //根据踏频估算和前后齿比
|
|
|
+ {
|
|
|
+ UWORD uwRpmByCadence = 0, uwRpmByMotor = 0, uwRpmWheel = 0;
|
|
|
+ uwRpmByCadence = (SLONG)((cadence_stFreGetOut.uwLPFFrequencyPu * cof_uwFbHz * 60 ) >> 20) * 24 / 10;
|
|
|
+ if(cp_stFlg.ThetaGetModelSelect == ANG_SWITCHHALL)
|
|
|
+ {
|
|
|
+ uwRpmByMotor = ((SLONG)abs(switchhall_stOut.swLowSpdLpfPu) * cof_uwVbRpm >> 15) * 1000 / ass_ParaCong.uwMechRationMotor; //减速比4.55
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uwRpmByMotor = ((SLONG)abs(scm_stSpdFbkLpf.slY.sw.hi)* cof_uwVbRpm >> 15) * 1000 / ass_ParaCong.uwMechRationMotor; //减速比4.55
|
|
|
+ }
|
|
|
+ uwRpmWheel = (uwRpmByMotor > uwRpmByCadence) ? (uwRpmByMotor * ass_ParaCong.uwNmFrontChainring / ass_ParaCong.uwNmFrontChainring) :
|
|
|
+ (uwRpmByCadence * ass_ParaCong.uwNmFrontChainring / ass_ParaCong.uwNmFrontChainring);
|
|
|
+ cp_stBikeRunInfoPara.BikeSpeedKmH =
|
|
|
+ ((ULONG)(uwRpmWheel * 6 * (ass_ParaCong.uwWheelPerimeter + ass_ParaCong.swDeltPerimeter)) * 1048) >> 20; // 1048 = Q20(1/1000) 0.1 km/h
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cp_stBikeRunInfoPara.BikeSpeedKmH =
|
|
|
+ (((SQWORD)bikespeed_stFreGetOut.uwFrequencyPu * FBASE * (ass_ParaCong.uwWheelPerimeter + ass_ParaCong.swDeltPerimeter) * 36 >> 20) * 1048 * 10) >> 20; // 1048 = Q20(1/1000) 0.1 km/h
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void Can_voMC_Run_200ms(void)
|