Chamber Heater PID (#21156)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@ -318,6 +318,11 @@ typedef struct SettingsDataStruct {
|
||||
//
|
||||
PID_t bedPID; // M304 PID / M303 E-1 U
|
||||
|
||||
//
|
||||
// PIDTEMPCHAMBER
|
||||
//
|
||||
PID_t chamberPID; // M309 PID / M303 E-2 U
|
||||
|
||||
//
|
||||
// User-defined Thermistors
|
||||
//
|
||||
@ -926,6 +931,25 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_WRITE(bed_pid);
|
||||
}
|
||||
|
||||
//
|
||||
// PIDTEMPCHAMBER
|
||||
//
|
||||
{
|
||||
_FIELD_TEST(chamberPID);
|
||||
|
||||
const PID_t chamber_pid = {
|
||||
#if DISABLED(PIDTEMPCHAMBER)
|
||||
NAN, NAN, NAN
|
||||
#else
|
||||
// Store the unscaled PID values
|
||||
thermalManager.temp_chamber.pid.Kp,
|
||||
unscalePID_i(thermalManager.temp_chamber.pid.Ki),
|
||||
unscalePID_d(thermalManager.temp_chamber.pid.Kd)
|
||||
#endif
|
||||
};
|
||||
EEPROM_WRITE(chamber_pid);
|
||||
}
|
||||
|
||||
//
|
||||
// User-defined Thermistors
|
||||
//
|
||||
@ -1787,6 +1811,22 @@ void MarlinSettings::postprocess() {
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Heated Chamber PID
|
||||
//
|
||||
{
|
||||
PID_t pid;
|
||||
EEPROM_READ(pid);
|
||||
#if ENABLED(PIDTEMPCHAMBER)
|
||||
if (!validating && !isnan(pid.Kp)) {
|
||||
// Scale PID values since EEPROM values are unscaled
|
||||
thermalManager.temp_chamber.pid.Kp = pid.Kp;
|
||||
thermalManager.temp_chamber.pid.Ki = scalePID_i(pid.Ki);
|
||||
thermalManager.temp_chamber.pid.Kd = scalePID_d(pid.Kd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// User-defined Thermistors
|
||||
//
|
||||
@ -2811,6 +2851,16 @@ void MarlinSettings::reset() {
|
||||
thermalManager.temp_bed.pid.Kd = scalePID_d(DEFAULT_bedKd);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Heated Chamber PID
|
||||
//
|
||||
|
||||
#if ENABLED(PIDTEMPCHAMBER)
|
||||
thermalManager.temp_chamber.pid.Kp = DEFAULT_chamberKp;
|
||||
thermalManager.temp_chamber.pid.Ki = scalePID_i(DEFAULT_chamberKi);
|
||||
thermalManager.temp_chamber.pid.Kd = scalePID_d(DEFAULT_chamberKd);
|
||||
#endif
|
||||
|
||||
//
|
||||
// User-Defined Thermistors
|
||||
//
|
||||
@ -3386,7 +3436,16 @@ void MarlinSettings::reset() {
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif // PIDTEMP || PIDTEMPBED
|
||||
#if ENABLED(PIDTEMPCHAMBER)
|
||||
CONFIG_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(
|
||||
" M309 P", thermalManager.temp_chamber.pid.Kp
|
||||
, " I", unscalePID_i(thermalManager.temp_chamber.pid.Ki)
|
||||
, " D", unscalePID_d(thermalManager.temp_chamber.pid.Kd)
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif // PIDTEMP || PIDTEMPBED || PIDTEMPCHAMBER
|
||||
|
||||
#if HAS_USER_THERMISTORS
|
||||
CONFIG_ECHO_HEADING("User thermistors:");
|
||||
|
Reference in New Issue
Block a user