Explorar el Código

fix 写SN号错误,中动100码电机,编码器做了零位置校准,软件偏移固定0

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 3 años
padre
commit
eaee8fea62

+ 1 - 1
Applications/app/app.c

@@ -112,7 +112,7 @@ static u32 _app_report_task(void *p) {
 	}
 	return 200;
 }
-static int plot_type = 4;
+static int plot_type = 1;
 static void plot_smo_angle(void) {
 	float smo_angle = foc_observer_smo_angle();
 	float delta = smo_angle - PMSM_FOC_Get()->in.s_hallAngle;

+ 5 - 1
Applications/app/nv_storage.c

@@ -424,7 +424,7 @@ void nv_storage_init(void) {
 	nv_read_foc_params();
 	nv_read_gear_configs();
 	sys_debug("encoder_off = %f\n", m_params.offset);
-	if ((m_params.mot_nr != MOTOR_NR) || (foc_params.pid_conf[PID_TRQ_id].kp != TRQ_PI_KP) || (foc_params.pid_conf[PID_TRQ_id].ki != TRQ_PI_KI)) {
+	if (m_params.mot_nr != MOTOR_NR) {
 		nv_default_motor_params();
 		nv_default_foc_params();
 		nv_save_foc_params();
@@ -433,6 +433,10 @@ void nv_storage_init(void) {
 #if CONFIG_MOT_TYPE==MOTOR_BLUESHARK_NEW1
 	m_params.offset = 0.0f; //编码器做了零位置校准
 #endif
+#if CONFIG_MOT_TYPE==MOTOR_BLUESHARK_ZD_100
+	m_params.offset = 0.0f; //编码器做了零位置校准
+#endif
+
 	sys_debug("current band %f -- %d\n", foc_params.n_currentBand, sizeof(foc_params_t));
 }
 

+ 1 - 1
Applications/foc/commands.c

@@ -485,7 +485,7 @@ static void process_foc_command(foc_cmd_body_t *command) {
 			if (command->len < 18) {
 				erroCode = FOC_Param_Err;
 			}else{
-				erroCode = nv_write_sn((u8 *)command->data, len)>0?0:1 ;
+				erroCode = nv_write_sn((u8 *)command->data, command->len)>0?0:1 ;
 			}
 			break;
 		}

+ 1 - 1
Applications/foc/commands.h

@@ -38,7 +38,7 @@ typedef enum {
 	Foc_Start_Write_TRQ_Table,
 	Foc_Write_TRQ_Table,
 	Foc_End_Write_TRQ_Table,
-	Foc_SN_Write,
+	Foc_SN_Write, //66
 	Foc_SN_Read,
 	Foc_Hall_Phase_Cali_Result = 160,
 	Foc_Hall_Offset_Cali_Result,