|
@@ -136,9 +136,7 @@ volatile bool Temperature::temp_meas_ready = false;
|
136
|
136
|
int Temperature::lpq_ptr = 0;
|
137
|
137
|
#endif
|
138
|
138
|
|
139
|
|
- float Temperature::pid_error[HOTENDS],
|
140
|
|
- Temperature::temp_iState_min[HOTENDS],
|
141
|
|
- Temperature::temp_iState_max[HOTENDS];
|
|
139
|
+ float Temperature::pid_error[HOTENDS];
|
142
|
140
|
bool Temperature::pid_reset[HOTENDS];
|
143
|
141
|
#endif
|
144
|
142
|
|
|
@@ -148,9 +146,7 @@ volatile bool Temperature::temp_meas_ready = false;
|
148
|
146
|
Temperature::pTerm_bed,
|
149
|
147
|
Temperature::iTerm_bed,
|
150
|
148
|
Temperature::dTerm_bed,
|
151
|
|
- Temperature::pid_error_bed,
|
152
|
|
- Temperature::temp_iState_min_bed,
|
153
|
|
- Temperature::temp_iState_max_bed;
|
|
149
|
+ Temperature::pid_error_bed;
|
154
|
150
|
#else
|
155
|
151
|
millis_t Temperature::next_bed_check_ms;
|
156
|
152
|
#endif
|
|
@@ -448,12 +444,6 @@ void Temperature::updatePID() {
|
448
|
444
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
449
|
445
|
last_e_position = 0;
|
450
|
446
|
#endif
|
451
|
|
- HOTEND_LOOP() {
|
452
|
|
- temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
|
453
|
|
- }
|
454
|
|
- #endif
|
455
|
|
- #if ENABLED(PIDTEMPBED)
|
456
|
|
- temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
|
457
|
447
|
#endif
|
458
|
448
|
}
|
459
|
449
|
|
|
@@ -564,7 +554,6 @@ float Temperature::get_pid_output(int e) {
|
564
|
554
|
}
|
565
|
555
|
pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX];
|
566
|
556
|
temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX];
|
567
|
|
- temp_iState[HOTEND_INDEX] = constrain(temp_iState[HOTEND_INDEX], temp_iState_min[HOTEND_INDEX], temp_iState_max[HOTEND_INDEX]);
|
568
|
557
|
iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
|
569
|
558
|
|
570
|
559
|
pid_output = pTerm[HOTEND_INDEX] + iTerm[HOTEND_INDEX] - dTerm[HOTEND_INDEX];
|
|
@@ -627,7 +616,6 @@ float Temperature::get_pid_output(int e) {
|
627
|
616
|
pid_error_bed = target_temperature_bed - current_temperature_bed;
|
628
|
617
|
pTerm_bed = bedKp * pid_error_bed;
|
629
|
618
|
temp_iState_bed += pid_error_bed;
|
630
|
|
- temp_iState_bed = constrain(temp_iState_bed, temp_iState_min_bed, temp_iState_max_bed);
|
631
|
619
|
iTerm_bed = bedKi * temp_iState_bed;
|
632
|
620
|
|
633
|
621
|
dTerm_bed = K2 * bedKd * (current_temperature_bed - temp_dState_bed) + K1 * dTerm_bed;
|
|
@@ -955,16 +943,10 @@ void Temperature::init() {
|
955
|
943
|
// populate with the first value
|
956
|
944
|
maxttemp[e] = maxttemp[0];
|
957
|
945
|
#if ENABLED(PIDTEMP)
|
958
|
|
- temp_iState_min[e] = 0.0;
|
959
|
|
- temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
|
960
|
946
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
961
|
947
|
last_e_position = 0;
|
962
|
948
|
#endif
|
963
|
949
|
#endif //PIDTEMP
|
964
|
|
- #if ENABLED(PIDTEMPBED)
|
965
|
|
- temp_iState_min_bed = 0.0;
|
966
|
|
- temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
|
967
|
|
- #endif //PIDTEMPBED
|
968
|
950
|
}
|
969
|
951
|
|
970
|
952
|
#if ENABLED(PIDTEMP) && ENABLED(PID_EXTRUSION_SCALING)
|