فهرست منبع

Walk模式不计算传动比,解决生产测试过程中转把转速低的问题。

dd 2 ماه پیش
والد
کامیت
a157e09fbf
2فایلهای تغییر یافته به همراه30 افزوده شده و 27 حذف شده
  1. 20 16
      1.FrameLayer/Source/TimeTask_Event.c
  2. 10 11
      3.BasicFunction/Source/canAppl.c

+ 20 - 16
1.FrameLayer/Source/TimeTask_Event.c

@@ -157,7 +157,7 @@ void  Event_1ms(void)
     {
         signal_state.Sensor = FALSE;
     }
-      
+
     // spd assist model flg
     if((cp_stFlg.RunModelSelect == CadAssist) || (cp_stFlg.RunModelSelect == TorqAssist))
     {
@@ -182,9 +182,6 @@ void  Event_1ms(void)
      }
 }
 
-
-
-
 void Event_5ms(void)
 {
    // DL_GPIO_togglePins(LED_PORT, LED_LED1_PIN);
@@ -195,7 +192,6 @@ void Event_5ms(void)
 
 }
 
-
 void Event_10ms(void)
 {
     // throttle vol ADC update
@@ -280,12 +276,20 @@ void Event_10ms(void)
        #endif
    CadSmartDisting();
    //整车传动比计算
-   BikeRatioCal_Process((abs(switchhall_stOut.swLowSpdLpfPu) * cof_uwVbRpm) >> 15, \
-                          ((ULONG)cadence_stFreGetOut.uwLPFFrequencyPu * cof_uwFbHz * 60) >> 20, \
-                          ((ULONG)bikespeed_stFreGetOut.uwFrequencyPu * cof_uwFbHz * 60) >> 20, \
-                          ((ULONG)torsensor_stTorSensorOut.uwTorquePu * cof_uwTorqNm) >> 14, \
-                          ((ULONG)adc_stUpOut.uwIbusAvgLpfPu * cof_uwIbAp) >> 14, \
-                          &Bike_RatioCalParam);
+   if((cp_stBikeRunInfoPara.uwBikeGear >= 1) && (cp_stBikeRunInfoPara.uwBikeGear <= 5))
+   {
+       BikeRatioCal_Process((abs(switchhall_stOut.swLowSpdLpfPu) * cof_uwVbRpm) >> 15, \
+                             ((ULONG)cadence_stFreGetOut.uwLPFFrequencyPu * cof_uwFbHz * 60) >> 20, \
+                             ((ULONG)bikespeed_stFreGetOut.uwFrequencyPu * cof_uwFbHz * 60) >> 20, \
+                             ((ULONG)torsensor_stTorSensorOut.uwTorquePu * cof_uwTorqNm) >> 14, \
+                             ((ULONG)adc_stUpOut.uwIbusAvgLpfPu * cof_uwIbAp) >> 14, \
+                             &Bike_RatioCalParam);
+   }
+   else
+   {
+       BikeRatioCal_Process(0, 0, 0, 0, 0, &Bike_RatioCalParam);
+   }
+
 }
 
 void  Event_20ms(void)
@@ -432,23 +436,23 @@ SLONG Signal_detect(void)
 {
     SLONG tmp_slGearSpeedRpm = 0;
     
-    if(MC_ControlCode.GearSt == 0x01)
+    if(cp_stBikeRunInfoPara.uwBikeGear == 0x01)
     {
         tmp_slGearSpeedRpm = M_R_SPD_RPM*10/25;
     }
-    else if(MC_ControlCode.GearSt == 0x02)
+    else if(cp_stBikeRunInfoPara.uwBikeGear == 0x02)
     {
         tmp_slGearSpeedRpm = M_R_SPD_RPM*15/25;
     }
-    else if(MC_ControlCode.GearSt == 0x03)
+    else if(cp_stBikeRunInfoPara.uwBikeGear == 0x03)
     {
         tmp_slGearSpeedRpm = M_R_SPD_RPM*15/25;
     }
-    else if(MC_ControlCode.GearSt == 0x04)
+    else if(cp_stBikeRunInfoPara.uwBikeGear == 0x04)
     {
         tmp_slGearSpeedRpm = M_R_SPD_RPM;
     }
-    else if(MC_ControlCode.GearSt == 0x05)
+    else if(cp_stBikeRunInfoPara.uwBikeGear == 0x05)
     {
         tmp_slGearSpeedRpm = M_R_SPD_RPM;
     }

+ 10 - 11
3.BasicFunction/Source/canAppl.c

@@ -271,41 +271,40 @@ void  Can_voInitMC_Run(void)
     // MC版本信息初始化,Mode和SN从EEPROM读取
     strncpy(MC_VerInfo.HW_Version, (char *)"VTA010155A0001  ", 16); //长度不超过16
     UBYTE MCU_ID[4] = {0, }, MCU_ID_Cal[2] = {0, };
-    memcpy((UBYTE*)MCU_ID, (UBYTE*)(0x41C40000), 4);
+    memcpy((UBYTE*)MCU_ID, (UBYTE*)(0x41C40000), 4); //读取MCU 32位ID
     MCU_ID_Cal[0] = MCU_ID[0] ^ MCU_ID[1];
     MCU_ID_Cal[1] = MCU_ID[2] ^ MCU_ID[3];
-    MC_VerInfo.HW_Version[14] = MCU_ID_Cal[0];
+    MC_VerInfo.HW_Version[14] = MCU_ID_Cal[0]; //校验转换为16位数据
     MC_VerInfo.HW_Version[15] = MCU_ID_Cal[1];
 
     // Software version
-    char chFwVersion[16]="V1r0r0_";
-    strncat(chFwVersion,COMPLIE_TIME,9); // Commit time COMPLIE_TIME
+    char chFwVersion[16] = "V1r0r0_";
+    strncat(chFwVersion, COMPLIE_TIME, 9);
     strncpy(MC_VerInfo.FW_Version, (char *)chFwVersion, 16);
     
     // Firmware Special Info
     char chFrimware[32]="NC2025X000-MS0000-V0r0. ";
 
-    strncat(chFrimware,FINGER_PRINT,8); // Git Version
+    strncat(chFrimware, FINGER_PRINT, 8); // Git Version
 
+    #if 0
     if(cp_stFlg.RunModelSelect == CadAssist)
     {
-        strncat(chFrimware,"C",1);  // Cadance assist end with "C"  Torque assist end with "T"
+        strncat(chFrimware, "C", 1);  // Cadance assist end with "C"  Torque assist end with "T"
     }
     else if(cp_stFlg.RunModelSelect == TorqAssist)
     {
-        strncat(chFrimware,"T",1); // Torque Assist end with "T", Cadence Assist end with "C"
+        strncat(chFrimware, "T", 1); // Torque Assist end with "T", Cadence Assist end with "C"
     }
     else
     {
         /* 不做处理*/
     }
-    strncpy(Firmware_Special, (char *)chFrimware, 32);
+    #endif
 
+    strncpy(Firmware_Special, (char *)chFrimware, 32);
 
     //电机型号
-//    memcpy(MC_VerInfo.Mode, Syspara2.flash_stPara.ubMotorVersion, sizeof(Syspara2.flash_stPara.ubMotorVersion));
-//    memcpy(MC_VerInfo.SN_Num, Syspara2.flash_stPara.ubSN, sizeof(Syspara2.flash_stPara.ubSN));
-
     memcpy(MC_VerInfo.Mode, Productionpara.ubMotorVersion, sizeof(Productionpara.ubMotorVersion));
     memcpy(MC_VerInfo.SN_Num, Productionpara.ubSN, sizeof(Productionpara.ubSN));