diff --git a/BALANCE/balance.c b/BALANCE/balance.c index cb3aef2..ce1f598 100644 --- a/BALANCE/balance.c +++ b/BALANCE/balance.c @@ -233,7 +233,7 @@ void Balance_task(void *pvParameters) } //If Turn_Off(Voltage) returns to 1, the car is not allowed to move, and the PWM value is set to 0 //如果Turn_Off(Voltage)返回值为1,不允许控制小车进行运动,PWM值设置为0 - else Set_Pwm(0,0,0,0,0); + else Set_Pwm(0,0,0,0,(Car_Mode == Akm_Car) ? SERVO_INIT : 0); } } } diff --git a/BALANCE/system.c b/BALANCE/system.c index d0d48ec..743385e 100644 --- a/BALANCE/system.c +++ b/BALANCE/system.c @@ -15,7 +15,7 @@ u8 Car_Mode=4; //Servo control PWM value, Ackerman car special //舵机控制PWM值,阿克曼小车专用 -int Servo; +int Servo = SERVO_INIT; //Default speed of remote control car, unit: mm/s //遥控小车的默认速度,单位:mm/s diff --git a/HARDWARE/motor.h b/HARDWARE/motor.h index 72c9a71..c8e4f32 100644 --- a/HARDWARE/motor.h +++ b/HARDWARE/motor.h @@ -49,7 +49,7 @@ #define EN PDin(3) #define Servo_PWM TIM12->CCR2 -#define SERVO_INIT 1600 //Servo zero point //舵机零点 +#define SERVO_INIT 1590 //Servo zero point //锟斤拷锟斤拷锟斤拷 void Enable_Pin(void); void Servo_PWM_Init(u16 arr,u16 psc); diff --git a/HARDWARE/timer.c b/HARDWARE/timer.c index 3e22255..846e553 100644 --- a/HARDWARE/timer.c +++ b/HARDWARE/timer.c @@ -465,10 +465,9 @@ void TIM12_SERVO_Init(u16 arr,u16 psc) //Enable timer //使能定时器 TIM_Cmd(TIM12, ENABLE); - //The channel value is initialized to 1500, corresponding to the steering gear zero - //通道值初始化为1500,舵机零点对应值 - TIM12->CCR2=1500; - TIM12->CCR1=1500; + //Initialize both servo channels to the configured steering center. + TIM12->CCR2=SERVO_INIT; + TIM12->CCR1=SERVO_INIT; } diff --git a/doc/todo.md b/doc/todo.md new file mode 100644 index 0000000..3d45259 --- /dev/null +++ b/doc/todo.md @@ -0,0 +1,7 @@ +1. 瀹炴祴杞窛銆佽酱璺濆拰鏈澶у彲鐢ㄨ浆瑙 +淇敼浜嗚浆瑙掍腑浣嶅肩殑闂锛屼繚鎸佺洿绾胯椹 SERVO_INIT 1590 + +2. 淇鍚庤疆鍗婂緞鍏紡 +3. 鍏堥檺鍒惰浆瑙掞紝鍐嶈绠楀乏鍙宠疆閫 +4. 閲嶆柊鏍囧畾鑸垫満 PWM 涓庡疄闄呰疆瑙掑叧绯 +5. 杈ㄨ瘑鍚庤疆鐢垫満鍜岃皟鏁 PI \ No newline at end of file