FW 2.18: Better FOC sensorless startup, app adc safety fix

This commit is contained in:
Benjamin Vedder 2016-05-19 19:24:01 +02:00
parent cb2a205cb8
commit ed61c4d332
4 changed files with 20 additions and 4 deletions

View File

@ -308,6 +308,17 @@ static THD_FUNCTION(adc_thread, arg) {
}
pulses_without_power_before = ms_without_power;
mc_interface_set_brake_current(timeout_get_brake_current());
if (config.multi_esc) {
for (int i = 0;i < CAN_STATUS_MSGS_TO_STORE;i++) {
can_status_msg *msg = comm_can_get_status_msg_index(i);
if (msg->id >= 0 && UTILS_AGE_S(msg->rx_time) < MAX_CAN_AGE) {
comm_can_set_current_brake(msg->id, timeout_get_brake_current());
}
}
}
continue;
}

View File

@ -27,7 +27,7 @@
// Firmware version
#define FW_VERSION_MAJOR 2
#define FW_VERSION_MINOR 17
#define FW_VERSION_MINOR 18
#include "datatypes.h"
@ -67,6 +67,7 @@
*/
//#define MCCONF_DEFAULT_USER "mcconf_sten.h"
//#define MCCONF_DEFAULT_USER "mcconf_sp_540kv.h"
//#define MCCONF_DEFAULT_USER "mcconf_castle_2028.h"
/*
* Select default user app configuration

View File

@ -241,7 +241,7 @@
#define MCCONF_FOC_DUTY_DOWNRAMP_KI 200.0 // PI controller for duty control when decreasing the duty
#endif
#ifndef MCCONF_FOC_OPENLOOP_RPM
#define MCCONF_FOC_OPENLOOP_RPM 350.0 // Openloop RPM (sensorless low speed or when finding index pulse)
#define MCCONF_FOC_OPENLOOP_RPM 1200.0 // Openloop RPM (sensorless low speed or when finding index pulse)
#endif
#ifndef MCCONF_FOC_SL_OPENLOOP_HYST
#define MCCONF_FOC_SL_OPENLOOP_HYST 0.5 // Time below min RPM to activate openloop (s)

View File

@ -1688,8 +1688,12 @@ static THD_FUNCTION(timer_thread, arg) {
return;
}
float openloop_rpm = utils_map(fabsf(m_motor_state.iq_target),
0.0, m_conf->lo_current_max,
0.0, m_conf->foc_openloop_rpm);
const float dt = 0.001;
const float min_rads = (m_conf->foc_openloop_rpm * 2.0 * M_PI) / 60.0;
const float min_rads = (openloop_rpm * 2.0 * M_PI) / 60.0;
static float min_rpm_hyst_timer = 0.0;
static float min_rpm_timer = 0.0;
@ -1712,7 +1716,7 @@ static THD_FUNCTION(timer_thread, arg) {
}
// Don't use this in brake mode.
if (m_control_mode == CONTROL_MODE_CURRENT_BRAKE) {
if (m_control_mode == CONTROL_MODE_CURRENT_BRAKE || fabsf(m_motor_state.duty_now) < 0.001) {
min_rpm_hyst_timer = 0.0;
m_phase_observer_override = false;
}