Browse Source

Change PID dummy value to NAN

Fixes #17078
vanilla_fb_2.0.x
Scott Lahteine 5 years ago
parent
commit
913de024a9
  1. 10
      Marlin/src/module/configuration_store.cpp
  2. 8
      Marlin/src/module/temperature.h

10
Marlin/src/module/configuration_store.cpp

@ -851,8 +851,8 @@ void MarlinSettings::postprocess() {
HOTEND_LOOP() {
PIDCF_t pidcf = {
#if DISABLED(PIDTEMP)
DUMMY_PID_VALUE, DUMMY_PID_VALUE, DUMMY_PID_VALUE,
DUMMY_PID_VALUE, DUMMY_PID_VALUE
NAN, NAN, NAN,
NAN, NAN
#else
PID_PARAM(Kp, e),
unscalePID_i(PID_PARAM(Ki, e)),
@ -881,7 +881,7 @@ void MarlinSettings::postprocess() {
const PID_t bed_pid = {
#if DISABLED(PIDTEMPBED)
DUMMY_PID_VALUE, DUMMY_PID_VALUE, DUMMY_PID_VALUE
NAN, NAN, NAN
#else
// Store the unscaled PID values
thermalManager.temp_bed.pid.Kp,
@ -1725,7 +1725,7 @@ void MarlinSettings::postprocess() {
PIDCF_t pidcf;
EEPROM_READ(pidcf);
#if ENABLED(PIDTEMP)
if (!validating && pidcf.Kp != DUMMY_PID_VALUE) {
if (!validating && !isnan(pidcf.Kp)) {
// Scale PID values since EEPROM values are unscaled
PID_PARAM(Kp, e) = pidcf.Kp;
PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
@ -1761,7 +1761,7 @@ void MarlinSettings::postprocess() {
PID_t pid;
EEPROM_READ(pid);
#if ENABLED(PIDTEMPBED)
if (!validating && pid.Kp != DUMMY_PID_VALUE) {
if (!validating && !isnan(pid.Kp)) {
// Scale PID values since EEPROM values are unscaled
thermalManager.temp_bed.pid.Kp = pid.Kp;
thermalManager.temp_bed.pid.Ki = scalePID_i(pid.Ki);

8
Marlin/src/module/temperature.h

@ -74,8 +74,6 @@ hotend_pid_t;
typedef IF<(LPQ_MAX_LEN > 255), uint16_t, uint8_t>::type lpq_ptr_t;
#endif
#define DUMMY_PID_VALUE 3000.0f
#if ENABLED(PIDTEMP)
#define _PID_Kp(H) Temperature::temp_hotend[H].pid.Kp
#define _PID_Ki(H) Temperature::temp_hotend[H].pid.Ki
@ -92,9 +90,9 @@ hotend_pid_t;
#define _PID_Kf(H) 0
#endif
#else
#define _PID_Kp(H) DUMMY_PID_VALUE
#define _PID_Ki(H) DUMMY_PID_VALUE
#define _PID_Kd(H) DUMMY_PID_VALUE
#define _PID_Kp(H) NAN
#define _PID_Ki(H) NAN
#define _PID_Kd(H) NAN
#define _PID_Kc(H) 1
#endif

Loading…
Cancel
Save