Update temperature.cpp
This commit is contained in:
parent
a765c98850
commit
1a2f1d4974
1 changed files with 2 additions and 20 deletions
|
@ -136,9 +136,7 @@ volatile bool Temperature::temp_meas_ready = false;
|
|||
int Temperature::lpq_ptr = 0;
|
||||
#endif
|
||||
|
||||
float Temperature::pid_error[HOTENDS],
|
||||
Temperature::temp_iState_min[HOTENDS],
|
||||
Temperature::temp_iState_max[HOTENDS];
|
||||
float Temperature::pid_error[HOTENDS];
|
||||
bool Temperature::pid_reset[HOTENDS];
|
||||
#endif
|
||||
|
||||
|
@ -148,9 +146,7 @@ volatile bool Temperature::temp_meas_ready = false;
|
|||
Temperature::pTerm_bed,
|
||||
Temperature::iTerm_bed,
|
||||
Temperature::dTerm_bed,
|
||||
Temperature::pid_error_bed,
|
||||
Temperature::temp_iState_min_bed,
|
||||
Temperature::temp_iState_max_bed;
|
||||
Temperature::pid_error_bed;
|
||||
#else
|
||||
millis_t Temperature::next_bed_check_ms;
|
||||
#endif
|
||||
|
@ -448,12 +444,6 @@ void Temperature::updatePID() {
|
|||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
last_e_position = 0;
|
||||
#endif
|
||||
HOTEND_LOOP() {
|
||||
temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
|
||||
}
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -564,7 +554,6 @@ float Temperature::get_pid_output(int e) {
|
|||
}
|
||||
pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX];
|
||||
temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX];
|
||||
temp_iState[HOTEND_INDEX] = constrain(temp_iState[HOTEND_INDEX], temp_iState_min[HOTEND_INDEX], temp_iState_max[HOTEND_INDEX]);
|
||||
iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
|
||||
|
||||
pid_output = pTerm[HOTEND_INDEX] + iTerm[HOTEND_INDEX] - dTerm[HOTEND_INDEX];
|
||||
|
@ -627,7 +616,6 @@ float Temperature::get_pid_output(int e) {
|
|||
pid_error_bed = target_temperature_bed - current_temperature_bed;
|
||||
pTerm_bed = bedKp * pid_error_bed;
|
||||
temp_iState_bed += pid_error_bed;
|
||||
temp_iState_bed = constrain(temp_iState_bed, temp_iState_min_bed, temp_iState_max_bed);
|
||||
iTerm_bed = bedKi * temp_iState_bed;
|
||||
|
||||
dTerm_bed = K2 * bedKd * (current_temperature_bed - temp_dState_bed) + K1 * dTerm_bed;
|
||||
|
@ -955,16 +943,10 @@ void Temperature::init() {
|
|||
// populate with the first value
|
||||
maxttemp[e] = maxttemp[0];
|
||||
#if ENABLED(PIDTEMP)
|
||||
temp_iState_min[e] = 0.0;
|
||||
temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
|
||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||
last_e_position = 0;
|
||||
#endif
|
||||
#endif //PIDTEMP
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
temp_iState_min_bed = 0.0;
|
||||
temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
|
||||
#endif //PIDTEMPBED
|
||||
}
|
||||
|
||||
#if ENABLED(PIDTEMP) && ENABLED(PID_EXTRUSION_SCALING)
|
||||
|
|
Reference in a new issue