first try with simplified position setter.

This commit is contained in:
Teslafly 2022-04-07 00:54:45 -05:00
parent b6a8cf41a5
commit 690e7fd37a
2 changed files with 13 additions and 2 deletions

View File

@ -333,6 +333,16 @@ static THD_FUNCTION(ppm_thread, arg) {
}
break;
case PPM_CTRL_TYPE_PID_POSITION: // make this an actual type.
if (fabsf(servo_val) < 0.001) {
pulses_without_power++;
}
if (!(pulses_without_power < MIN_PULSES_WITHOUT_POWER && config.safe_start)) {
mc_interface_set_pid_pos(servo_val * 360);
}
break;
default:
continue;
}

View File

@ -550,12 +550,13 @@ typedef enum {
PPM_CTRL_TYPE_CURRENT,
PPM_CTRL_TYPE_CURRENT_NOREV,
PPM_CTRL_TYPE_CURRENT_NOREV_BRAKE,
PPM_CTRL_TYPE_CURRENT_BRAKE_REV_HYST,
PPM_CTRL_TYPE_CURRENT_SMART_REV,
PPM_CTRL_TYPE_DUTY,
PPM_CTRL_TYPE_DUTY_NOREV,
PPM_CTRL_TYPE_PID,
PPM_CTRL_TYPE_PID_NOREV,
PPM_CTRL_TYPE_CURRENT_BRAKE_REV_HYST,
PPM_CTRL_TYPE_CURRENT_SMART_REV
PPM_CTRL_TYPE_PID_POSITION
} ppm_control_type;
typedef struct {