Disable HFI start in braking mode

This commit is contained in:
Benjamin Vedder 2021-11-08 22:48:15 +01:00
parent d62f0b3617
commit cb84c94788
2 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@
#define FW_VERSION_MAJOR 5
#define FW_VERSION_MINOR 03
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER 61
#define FW_TEST_VERSION_NUMBER 62
#include "datatypes.h"

View File

@ -3691,7 +3691,9 @@ static void control_current(volatile motor_all_state_t *motor, float dt) {
float abs_rpm = fabsf(RADPS2RPM_f(motor->m_speed_est_fast));
bool do_hfi = (conf_now->foc_sensor_mode == FOC_SENSOR_MODE_HFI ||
conf_now->foc_sensor_mode == FOC_SENSOR_MODE_HFI_START) &&
(conf_now->foc_sensor_mode == FOC_SENSOR_MODE_HFI_START &&
motor->m_control_mode != CONTROL_MODE_CURRENT_BRAKE &&
fabsf(state_m->iq_target) > conf_now->cc_min_current)) &&
!motor->m_phase_override &&
abs_rpm < (conf_now->foc_sl_erpm_hfi * (motor->m_cc_was_hfi ? 1.8 : 1.5));