mirror of https://github.com/rusefi/bldc.git
Merge pull request #513 from TechAUmNu/Openloop-faults
Add fault check to openloop commands
This commit is contained in:
commit
0f40933c8b
|
@ -844,6 +844,11 @@ void mcpwm_foc_set_handbrake(float current) {
|
|||
* The RPM to use.
|
||||
*/
|
||||
void mcpwm_foc_set_openloop(float current, float rpm) {
|
||||
// Check for an active fault
|
||||
if (mc_interface_get_fault() != FAULT_CODE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
utils_truncate_number(¤t, -get_motor_now()->m_conf->l_current_max * get_motor_now()->m_conf->l_current_max_scale,
|
||||
get_motor_now()->m_conf->l_current_max * get_motor_now()->m_conf->l_current_max_scale);
|
||||
|
||||
|
@ -871,6 +876,11 @@ void mcpwm_foc_set_openloop(float current, float rpm) {
|
|||
* The phase to use in degrees, range [0.0 360.0]
|
||||
*/
|
||||
void mcpwm_foc_set_openloop_phase(float current, float phase) {
|
||||
// Check for an active fault
|
||||
if (mc_interface_get_fault() != FAULT_CODE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
utils_truncate_number(¤t, -get_motor_now()->m_conf->l_current_max * get_motor_now()->m_conf->l_current_max_scale,
|
||||
get_motor_now()->m_conf->l_current_max * get_motor_now()->m_conf->l_current_max_scale);
|
||||
|
||||
|
@ -952,6 +962,11 @@ void mcpwm_foc_get_voltage_offsets_undriven(
|
|||
* The RPM to use.
|
||||
*/
|
||||
void mcpwm_foc_set_openloop_duty(float dutyCycle, float rpm) {
|
||||
// Check for an active fault
|
||||
if (mc_interface_get_fault() != FAULT_CODE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_motor_now()->m_control_mode = CONTROL_MODE_OPENLOOP_DUTY;
|
||||
get_motor_now()->m_duty_cycle_set = dutyCycle;
|
||||
get_motor_now()->m_openloop_speed = RPM2RADPS_f(rpm);
|
||||
|
@ -972,6 +987,11 @@ void mcpwm_foc_set_openloop_duty(float dutyCycle, float rpm) {
|
|||
* The phase to use in degrees, range [0.0 360.0]
|
||||
*/
|
||||
void mcpwm_foc_set_openloop_duty_phase(float dutyCycle, float phase) {
|
||||
// Check for an active fault
|
||||
if (mc_interface_get_fault() != FAULT_CODE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_motor_now()->m_control_mode = CONTROL_MODE_OPENLOOP_DUTY_PHASE;
|
||||
get_motor_now()->m_duty_cycle_set = dutyCycle;
|
||||
get_motor_now()->m_openloop_phase = DEG2RAD_f(phase);
|
||||
|
|
Loading…
Reference in New Issue