|
|
@@ -187,6 +187,7 @@ void mc_conf_default(void) {
|
|
|
conf.m.gear_ratio = CONFIG_Motor_GearRatio;
|
|
|
conf.m.max_fw_id = CONFIG_Motor_MaxFwDCurr;
|
|
|
conf.m.max_torque = CONFIG_Motor_MaxTorque;
|
|
|
+ conf.m.encoder_offset = CONFIG_Motor_EncOffset;
|
|
|
conf.c.max_dc_vol = CONFIG_Foc_MaxDCVol;
|
|
|
conf.c.min_dc_vol = CONFIG_Foc_MinDCVol;
|
|
|
conf.c.max_phase_curr = CONFIG_Foc_MaxPhaseCurr;
|
|
|
@@ -277,7 +278,7 @@ void mc_conf_init(void) {
|
|
|
mc_conf_default();
|
|
|
mc_conf_save();
|
|
|
}
|
|
|
- sys_debug("mc conf band %d, pid: %f, %f, %f, %f\n", conf.c.dq_loop_bandwith, conf.c.pid[PID_ID_ID].kp, conf.c.pid[PID_ID_ID].ki, conf.c.pid[PID_IQ_ID].kp, conf.c.pid[PID_IQ_ID].ki);
|
|
|
+ sys_debug("mc conf band %d, pid: %f, %f, %f, %f, %d\n", conf.c.dq_loop_bandwith, conf.c.pid[PID_ID_ID].kp, conf.c.pid[PID_ID_ID].ki, conf.c.pid[PID_IQ_ID].kp, conf.c.pid[PID_IQ_ID].ki, mc_conf()->m.encoder_offset);
|
|
|
}
|
|
|
|
|
|
int mc_conf_decode_motor(u8 *buff) {
|
|
|
@@ -295,6 +296,7 @@ int mc_conf_decode_motor(u8 *buff) {
|
|
|
conf.m.gear_ratio = decode_float(buff);buff += 4;
|
|
|
conf.m.max_fw_id = decode_u16(buff); buff += 2;
|
|
|
conf.m.max_torque = decode_u16(buff); buff += 2;
|
|
|
+ conf.m.encoder_offset = decode_s16(buff); buff += 2;
|
|
|
return buff - ori;
|
|
|
}
|
|
|
|
|
|
@@ -313,6 +315,7 @@ int mc_conf_encode_motor(u8 *buff) {
|
|
|
encode_float(buff, conf.m.gear_ratio);buff += 4;
|
|
|
encode_u16(buff, conf.m.max_fw_id); buff += 2;
|
|
|
encode_u16(buff, conf.m.max_torque); buff += 2;
|
|
|
+ encode_s16(buff, conf.m.encoder_offset); buff += 2;
|
|
|
return buff - ori;
|
|
|
}
|
|
|
|