Browse Source

建议所有定制化内容在Customization.h中定义相关宏,通过宏区分标准程序与定制程序,标准程序不受定制程序影响。
塔基传感器定制内容:
0.增加踏频传感器协议解析;
1.程序不再通过AD采集力矩,采用塔基传感器的力矩信号,周期由1ms调整至10ms;
2.程序不再通过脉冲采集车速,采用塔基传感器的飞轮转速计算车速,并计算里程;
3.程序不再通过脉冲采集踏频,采用塔基传感器的踏频数据计算踏频;
4.程序不再通过AD采集电机温度,采用塔基传感器的温度数据;

Ye Jin 5 tháng trước cách đây
mục cha
commit
5234875357

+ 6 - 5
1.FrameLayer/Source/TimeTask_Event.c

@@ -28,7 +28,6 @@
 #include "MosResCalib.h"
 #include "bikespeed.h"
 #include "UserGpio_Config.h"
-#include "uart_TORG4BBSensor.h"
 //#include "asr.h"
 
 //#include "STLmain.h"
@@ -124,7 +123,9 @@ void  Event_1ms(void)
     else if(cp_stFlg.RunModelSelect == TorqAssist)
     {
         /* 力矩AD值处理 */
-//        torsensor_voTorADC();
+#if (TORG4BBTORQU_ENABLE == 0)
+        torsensor_voTorADC();
+#endif
         /* 力矩中轴助力输入 */
         ass_voTorqAssistInput();        
         /* 根据踏频脉冲对力矩信号进行滑动平均处理 */
@@ -239,9 +240,9 @@ void Event_10ms(void)
     
     cadence_stFreGetOut.uwFreqPercent = ((ULONG)cadence_stFreGetOut.uwLPFFrequencyPu << 14) / cadence_stFreGetCof.uwMaxCadenceFre; // Q14
     
-
+#if (TORG4BBTORQU_ENABLE == 1)
     TORG4BB_Torque_Handler();
-
+#endif
     /* Trip cal when open */
     bikespeed_votempTripCal();
 
@@ -719,7 +720,7 @@ void StartSelectAssistMode(void)
 ****************************************************************/
 void BOKESPEED_Handler(void)
 {
-#if TORG4BBTORQU_ENABLE
+#if (TORG4BBTORQU_ENABLE == 1)
     bikespeed_stFreGetOut.uwLPFFrequencyPu = (UWORD)((((stTORG4BBInfo.uwFlyWheelSpeed<<20)*6/1000/FBASE)<<20)/36/1048/10);
 #else
   /* add user code begin TMR16_GLOBAL_IRQ 0 */

+ 2 - 2
2.MotorDrive/Source/adc.c

@@ -34,7 +34,7 @@ Revising History (ECL of this file):
 #include "UserGpio_Config.h"
 #include "MosResCalib.h"
 #include "hwsetup.h"
-#include "uart_TORG4BBSensor.h"
+#include "FuncLayerAPI.h"
 
  extern uint16_t gAdcResult0[8];
 /************************************************************************
@@ -382,7 +382,7 @@ void adc_voSampleUp(ADC_COF *cof, ADC_UP_OUT *out)
     #endif
         break;
         case 1:		//MOTOR_TEMP
-#if TORG4BBTORQU_ENABLE
+#if (TORG4BBTORQU_ENABLE == 1)
             out->MotorTemp = TORG4BB_Get_Temp();
 #else
            if( out->MotorTempReg>1241)//1241-1V if(Get_MOTTEMP_PORT()!=0)//(iGpio_Read(HW_GPIO_MOTTEMP_PIN) != 0)

+ 15 - 0
3.BasicFunction/Include/Customization.h

@@ -0,0 +1,15 @@
+/*
+ * Customization.h
+ *
+ *  Created on: 2025年3月13日
+ *      Author: yejin4
+ */
+
+#ifndef _CUSTOMIZATION_H_
+#define _CUSTOMIZATION_H_
+
+
+#define TORG4BBTORQU_ENABLE                     1   //0-标准程序,1-塔基传感器定制
+
+
+#endif /* 3_BASICFUNCTION_INCLUDE_CUSTOMIZATION_H_ */

+ 1 - 0
3.BasicFunction/Include/FuncLayerAPI.h

@@ -24,6 +24,7 @@
 #include "AssistCurve.h"
 #include "bikeinformation.h"
 #include "uart_TORG4BBSensor.h"
+#include "Customization.h"
 /****************************************
  *
  *          Definitions & Macros

+ 0 - 1
3.BasicFunction/Include/uart_TORG4BBSensor.h

@@ -41,7 +41,6 @@
 /* Includes ------------------------------------------------------------------*/
 #include "usart.h"
 
-#define TORG4BBTORQU_ENABLE                     1
 #define TORG4BBCADENCE_LPF_GAIN                 80
 #define TORG4BBTORQUE_TIMEOUT_UNIT               10  //ms
 #define TORG4BBTORQUE_TIMEOUT_TIME               100  //ms

+ 2 - 1
3.BasicFunction/Source/bikespeed.c

@@ -25,6 +25,7 @@
 //#include "api.h"
 #include "board_config.h"
 #include "UserGpio_Config.h"
+#include "FuncLayerAPI.h"
 /******************************
  *
  *  Parameter
@@ -290,7 +291,7 @@ void bikespeed_voGetBikeSpeedPwrError(UWORD BikeSpeedPwrVolPu)
 ****************************************************************/
 void bikespeed_votempTripCal(void)
 {
-#if TORG4BBTORQU_ENABLE
+#if (TORG4BBTORQU_ENABLE == 1)
     static ULONG ulBikeSpeedCalTrip = 0;
     ulBikeSpeedCalTrip = ulBikeSpeedCalTrip + stTORG4BBInfo.uwFlyWheelSpeed*(ass_ParaCong.uwWheelPerimeter + ass_ParaCong.swDeltPerimeter)/60;//(0.01cm/10ms)
     if(ulBikeSpeedCalTrip > 1000000)

+ 1 - 1
3.BasicFunction/Source/usart.c

@@ -55,7 +55,7 @@
 #include "uart_J.h"
 #include "hwsetup.h"
 #include "UserGpio_Config.h"
-#include "uart_TORG4BBSensor.h"
+#include "FuncLayerAPI.h"
 //#include "api.h"
 //#include "board_config.h"
 /* Private variables ---------------接收缓存区------------------------------------------*/