|
|
@@ -24,6 +24,8 @@
|
|
|
static bool mc_is_hwbrake(void);
|
|
|
static void _pwm_brake_prot_timer_handler(shark_timer_t *);
|
|
|
static shark_timer_t _brake_prot_timer = TIMER_INIT(_brake_prot_timer, _pwm_brake_prot_timer_handler);
|
|
|
+static void _autohold_beep_timer_handler(shark_timer_t *);
|
|
|
+static shark_timer_t _autohold_beep_timer = TIMER_INIT(_autohold_beep_timer, _autohold_beep_timer_handler);
|
|
|
|
|
|
|
|
|
static motor_t motor = {
|
|
|
@@ -436,9 +438,8 @@ bool mc_auto_hold(bool hold) {
|
|
|
PMSM_FOC_SetErrCode(FOC_Throttle_Err);
|
|
|
return false;
|
|
|
}
|
|
|
- motor.b_auto_hold = hold;
|
|
|
-
|
|
|
u32 mask = cpu_enter_critical();
|
|
|
+ motor.b_auto_hold = hold;
|
|
|
if (!PMSM_FOC_Is_Start()) {
|
|
|
PMSM_FOC_Start(motor.mode);
|
|
|
PMSM_FOC_AutoHold(hold);
|
|
|
@@ -605,6 +606,10 @@ static bool mc_run_stall_process(u8 run_mode) {
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
+static void _autohold_beep_timer_handler(shark_timer_t *t) {
|
|
|
+ gpio_beep(60);
|
|
|
+}
|
|
|
+
|
|
|
static void mc_autohold_process(void) {
|
|
|
if (PMSM_FOC_AutoHoldding() && !mc_throttle_released()) {
|
|
|
mc_auto_hold(false);
|
|
|
@@ -615,7 +620,7 @@ static void mc_autohold_process(void) {
|
|
|
}else {
|
|
|
if (get_delta_ms(motor.n_autohold_time) >= CONFIG_AUTOHOLD_DETECT_TIME) {
|
|
|
mc_auto_hold(true);
|
|
|
- gpio_beep(50);
|
|
|
+ shark_timer_post(&_autohold_beep_timer, 0);
|
|
|
}
|
|
|
}
|
|
|
}else {
|