1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

Change DUMMY_PID_VALUE to NAN (#17079)

This commit is contained in:
Scott Lahteine 2020-03-06 14:12:27 -06:00 committed by GitHub
parent 0bc929aae7
commit 430adce327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,7 +363,6 @@ void MarlinSettings::postprocess() {
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
#define DUMMY_PID_VALUE 3000.0f
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
#define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR) #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
#define EEPROM_WRITE(VAR) write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc) #define EEPROM_WRITE(VAR) write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
@ -680,7 +679,7 @@ void MarlinSettings::postprocess() {
else else
#endif // !PIDTEMP #endif // !PIDTEMP
{ {
dummy = DUMMY_PID_VALUE; // When read, will not change the existing value dummy = NAN; // When read, will not change the existing value
EEPROM_WRITE(dummy); // Kp EEPROM_WRITE(dummy); // Kp
dummy = 0; dummy = 0;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
@ -696,7 +695,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(LPQ_LEN); EEPROM_WRITE(LPQ_LEN);
#if DISABLED(PIDTEMPBED) #if DISABLED(PIDTEMPBED)
dummy = DUMMY_PID_VALUE; dummy = NAN;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
#else #else
EEPROM_WRITE(thermalManager.bedKp); EEPROM_WRITE(thermalManager.bedKp);
@ -1303,7 +1302,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) { for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
EEPROM_READ(dummy); // Kp EEPROM_READ(dummy); // Kp
if (e < HOTENDS && dummy != DUMMY_PID_VALUE) { if (e < HOTENDS && !isnan(dummy)) {
// do not need to scale PID values as the values in EEPROM are already scaled // do not need to scale PID values as the values in EEPROM are already scaled
if (!validating) PID_PARAM(Kp, e) = dummy; if (!validating) PID_PARAM(Kp, e) = dummy;
EEPROM_READ(PID_PARAM(Ki, e)); EEPROM_READ(PID_PARAM(Ki, e));
@ -1340,7 +1339,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
EEPROM_READ(dummy); // bedKp EEPROM_READ(dummy); // bedKp
if (dummy != DUMMY_PID_VALUE) { if (!isnan(dummy)) {
if (!validating) thermalManager.bedKp = dummy; if (!validating) thermalManager.bedKp = dummy;
EEPROM_READ(thermalManager.bedKi); EEPROM_READ(thermalManager.bedKi);
EEPROM_READ(thermalManager.bedKd); EEPROM_READ(thermalManager.bedKd);