Ver Fonte

记录mc_start失败的错误码

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui há 2 anos atrás
pai
commit
b611823466
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      Applications/foc/commands.c

+ 4 - 1
Applications/foc/commands.c

@@ -11,6 +11,7 @@
 #include "foc/core/foc_observer.h"
 #include "foc/mc_error.h"
 #include "foc/motor/mot_params_ind.h"
+#include "foc/samples.h"
 
 #ifdef CONFIG_DQ_STEP_RESPONSE
 extern float target_d;
@@ -64,7 +65,9 @@ static void process_ext_command(foc_cmd_body_t *command) {
 		u8 b0 = decode_u8(command->data);
 		u8 p_mode = decode_8bits(b0, 0, 1);
 		if (p_mode == 1) {
-			mc_start(CTRL_MODE_TRQ);
+			if(!mc_start(CTRL_MODE_TRQ)) {
+				mc_crit_err_add(FOC_EV_MOS_Limit_L, PMSM_FOC_GetErrCode(), (s16)(get_throttle_float()*100.0f));
+			}
 		}else if (p_mode == 2) {
 			mc_stop();
 		}