|
|
@ -47,10 +47,6 @@
|
|
|
|
#include "watchdog.h"
|
|
|
|
#include "watchdog.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef K1 // Defined in Configuration.h in the PID settings
|
|
|
|
|
|
|
|
#define K2 (1.0-K1)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
|
|
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
|
|
|
static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
|
|
|
|
static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
|
|
|
|
static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
|
|
|
|
static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
|
|
|
@ -599,7 +595,7 @@ float Temperature::get_pid_output(const int8_t e) {
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
#if DISABLED(PID_OPENLOOP)
|
|
|
|
#if DISABLED(PID_OPENLOOP)
|
|
|
|
pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
|
|
|
|
pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
|
|
|
|
dTerm[HOTEND_INDEX] = K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + K1 * dTerm[HOTEND_INDEX];
|
|
|
|
dTerm[HOTEND_INDEX] = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + PID_K1 * dTerm[HOTEND_INDEX];
|
|
|
|
temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
|
|
|
|
temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
if (heater_idle_timeout_exceeded[HOTEND_INDEX]) {
|
|
|
|
if (heater_idle_timeout_exceeded[HOTEND_INDEX]) {
|
|
|
@ -696,7 +692,7 @@ float Temperature::get_pid_output(const int8_t e) {
|
|
|
|
temp_iState_bed += pid_error_bed;
|
|
|
|
temp_iState_bed += pid_error_bed;
|
|
|
|
iTerm_bed = bedKi * temp_iState_bed;
|
|
|
|
iTerm_bed = bedKi * temp_iState_bed;
|
|
|
|
|
|
|
|
|
|
|
|
dTerm_bed = K2 * bedKd * (current_temperature_bed - temp_dState_bed) + K1 * dTerm_bed;
|
|
|
|
dTerm_bed = PID_K2 * bedKd * (current_temperature_bed - temp_dState_bed) + PID_K1 * dTerm_bed;
|
|
|
|
temp_dState_bed = current_temperature_bed;
|
|
|
|
temp_dState_bed = current_temperature_bed;
|
|
|
|
|
|
|
|
|
|
|
|
pid_output = pTerm_bed + iTerm_bed - dTerm_bed;
|
|
|
|
pid_output = pTerm_bed + iTerm_bed - dTerm_bed;
|
|
|
|