Skip to content

Commit f8aebc1

Browse files
committed
Increased default PWM frequency from 10 to 100 Hz. Removed K constant from PID settings, added Feed Forward settings.
Signed-off-by: Bas Laarhoven <[email protected]>
1 parent 1c60ad3 commit f8aebc1

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

bebopr_r2.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const pwm_config_record pwm_config_data[] = {
7878
{
7979
.tag = pwm_extruder,
8080
.device_path = PWM_PATH_PREFIX "ehrpwm.2:0", // BEBOPR_R2_J3 - PWM1
81-
.frequency = 10,
81+
.frequency = 100,
8282
},
8383
{
8484
.tag = pwm_fan,
@@ -99,11 +99,12 @@ static const heater_config_record heater_config_data[] = {
9999
.analog_output = pwm_extruder,
100100
.pid =
101101
{
102-
.K = 0.0,
102+
.FF_factor = 0.33,
103+
.FF_offset = 40.0,
103104
.P = 15.0,
104-
.I = 10.0,
105+
.I = 0.0,
105106
.D = 0.0,
106-
.I_limit = 0.7,
107+
.I_limit = 10.0,
107108
},
108109
},
109110
{

heater.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ int heater_init( void)
221221
pd->pid_settings.P = ps->pid.P;
222222
pd->pid_settings.I = ps->pid.I;
223223
pd->pid_settings.D = ps->pid.D;
224-
pd->pid_settings.K = 0.0;
224+
pd->pid_settings.FF_factor= ps->pid.FF_factor;
225+
pd->pid_settings.FF_offset= ps->pid.FF_offset;
225226
pd->pid_settings.I_limit = ps->pid.I_limit;
226227
pd->setpoint = 0.0;
227228
pd->history_ix = 0;

heater.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88

99

1010
typedef struct {
11-
double K;
1211
double P;
1312
double I;
1413
double D;
1514
double I_limit;
15+
double FF_factor;
16+
double FF_offset;
1617
} pid_settings;
1718

1819
typedef const struct {

0 commit comments

Comments
 (0)