Explorar o código

示波器类型1,spd模式需要绘制参考速度

Signed-off-by: unknown <huhui@sharkgulf.com>
unknown %!s(int64=2) %!d(string=hai) anos
pai
achega
f087faee27
Modificáronse 3 ficheiros con 17 adicións e 11 borrados
  1. 15 9
      Applications/app/app.c
  2. 1 1
      Applications/prot/can_foc_msg.c
  3. 1 1
      Applications/prot/can_foc_msg.h

+ 15 - 9
Applications/app/app.c

@@ -87,16 +87,16 @@ static u32 _app_report_task(void *p) {
 	can_report_mpta_values(0x45);
 	can_report_phase_current(0x45);
 	if (mot_params_rs_ested()) {
-		can_report_motparam(mot_params_get_est_rs(), R_TYPE);
+		can_report_mot_params_ested(mot_params_get_est_rs(), R_TYPE);
 	}
 	if (mot_params_ld_ested()) {
-		can_report_motparam(mot_params_get_est_ld(), L_TYPE_D);
+		can_report_mot_params_ested(mot_params_get_est_ld(), L_TYPE_D);
 	}
 	if (mot_params_lq_ested()) {
-		can_report_motparam(mot_params_get_est_lq(), L_TYPE_Q);
+		can_report_mot_params_ested(mot_params_get_est_lq(), L_TYPE_Q);
 	}
 	if (mot_params_flux_ested()) {
-		can_report_motparam(mot_params_get_est_flux(), FLUX_TYPE);
+		can_report_mot_params_ested(mot_params_get_est_flux(), FLUX_TYPE);
 	}
 
 	if (++loop % 5 == 0) {
@@ -124,20 +124,26 @@ static u32 _app_report_task(void *p) {
 }
 int plot_type = 0;
 static void plot_smo_angle(void) {
-#if 1
 	float smo_angle = foc_observer_sensorless_angle();
 	float delta = smo_angle - foc()->in.mot_angle;
 	float s, c;
 	arm_sin_cos(delta, &s, &c);
 	delta = fast_atan2(s, c)/PI*180.0f;
 	can_plot3(foc()->in.mot_angle, smo_angle, delta);
-#else
-	can_plot2((s16)(foc_observer_sensorless_diff() * 100.0f), (s16)(foc_observer_sensorless_ration() * 100.0f));
-#endif
 }
 static u32 _app_plot_task(void * args) {
 	if (plot_type == 1) {
-		can_plot2((s16)foc_observer_sensorless_speed(), (s16)mot_contrl_get_speed(&motor.controller));
+		s16 plot_arg1 = (s16)foc_observer_sensorless_speed();
+		s16 plot_arg2 = (s16)mot_contrl_get_speed(&motor.controller);
+		if (mot_contrl()->mode_running == CTRL_MODE_SPD) {
+			if (mc_is_cruise_enabled()) {
+				plot_arg1 = mot_contrl()->cruise_vel.target;
+			}else {
+				plot_arg1 = mot_contrl()->target_vel.target;
+			}
+		}else {
+			can_plot2(plot_arg1, plot_arg2);
+		}
 	}else if (plot_type == 2) {
 		can_plot2(mot_contrl_get_final_torque(&motor.controller), mot_contrl()->target_torque);
 	}else if (plot_type == 3) {

+ 1 - 1
Applications/prot/can_foc_msg.c

@@ -140,7 +140,7 @@ void can_report_ext_status(u8 can) {
 	shark_can0_send_ext_message(0x1A014D43, data, sizeof(data));
 }
 
-void can_report_motparam(float v, u8 type) {
+void can_report_mot_params_ested(float v, u8 type) {
 	u8 data[8];
 	encoder_can_key(data, CMD_2_CAN_KEY(Foc_MotPara_Report));
 	encode_u8(data + 2, type);

+ 1 - 1
Applications/prot/can_foc_msg.h

@@ -18,7 +18,7 @@ void can_mcast_foc_status2(void);
 void can_plot1(s16 v1);
 void can_plot2(s16 v1, s16 v2);
 void can_plot3(s16 v1, s16 v2, s16 v3);
-void can_report_motparam(float v, u8 type);
+void can_report_mot_params_ested(float v, u8 type);
 
 #endif	/*_Can_Foc_Msg_H__ */