Browse Source

fix motor lock error

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 years ago
parent
commit
a1f6f03727
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Applications/foc/motor/motor.c

+ 3 - 3
Applications/foc/motor/motor.c

@@ -175,7 +175,7 @@ bool mc_start(u8 mode) {
 	}
 	}
 	MC_Check_MosVbusThrottle();
 	MC_Check_MosVbusThrottle();
 
 
-	if (mc_unsafe_critical_error() != 0) {
+	if (mc_unsafe_critical_error()) {
 		PMSM_FOC_SetErrCode(FOC_Have_CritiCal_Err);
 		PMSM_FOC_SetErrCode(FOC_Have_CritiCal_Err);
 		return false;
 		return false;
 	}
 	}
@@ -206,7 +206,7 @@ bool mc_start(u8 mode) {
 	phase_current_offset_calibrate();
 	phase_current_offset_calibrate();
 	pwm_start();
 	pwm_start();
 	delay_us(10); //wait for ebrake error
 	delay_us(10); //wait for ebrake error
-	if (mc_get_critical_error() != 0) {
+	if (mc_unsafe_critical_error()) {
 		mc_stop();
 		mc_stop();
 		return false;
 		return false;
 	}
 	}
@@ -589,7 +589,7 @@ static bool mc_is_gpio_mlock(void) {
 	int count = 50;
 	int count = 50;
 	int settimes = 0;
 	int settimes = 0;
 	while(count-- > 0) {
 	while(count-- > 0) {
-		bool b1 = mc_get_gpio_brake();
+		bool b1 = gpio_motor_locked();
 		if (b1) {
 		if (b1) {
 			settimes ++;
 			settimes ++;
 		}
 		}