MAX_EXTRUDERS replaces mysterious "4"

This commit is contained in:
Scott Lahteine 2016-06-30 00:07:31 -07:00
parent bc3748b7bc
commit 787f394676

View file

@ -40,6 +40,7 @@
// Change EEPROM version if these are changed: // Change EEPROM version if these are changed:
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
#define MAX_EXTRUDERS 4
/** /**
* V24 EEPROM Layout: * V24 EEPROM Layout:
@ -270,7 +271,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, absPreheatHPBTemp); EEPROM_WRITE_VAR(i, absPreheatHPBTemp);
EEPROM_WRITE_VAR(i, absPreheatFanSpeed); EEPROM_WRITE_VAR(i, absPreheatFanSpeed);
for (uint8_t e = 0; e < 4; e++) { for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
if (e < HOTENDS) { if (e < HOTENDS) {
@ -345,7 +346,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, volumetric_enabled); EEPROM_WRITE_VAR(i, volumetric_enabled);
// Save filament sizes // Save filament sizes
for (uint8_t q = 0; q < 4; q++) { for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
if (q < EXTRUDERS) dummy = filament_size[q]; if (q < EXTRUDERS) dummy = filament_size[q];
EEPROM_WRITE_VAR(i, dummy); EEPROM_WRITE_VAR(i, dummy);
} }
@ -452,7 +453,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, absPreheatFanSpeed); EEPROM_READ_VAR(i, absPreheatFanSpeed);
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
for (uint8_t e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
EEPROM_READ_VAR(i, dummy); // Kp EEPROM_READ_VAR(i, dummy); // Kp
if (e < HOTENDS && dummy != DUMMY_PID_VALUE) { if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
// 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
@ -471,7 +472,7 @@ void Config_RetrieveSettings() {
} }
#else // !PIDTEMP #else // !PIDTEMP
// 4 x 4 = 16 slots for PID parameters // 4 x 4 = 16 slots for PID parameters
for (uint8_t q=16; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd, Kc for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ_VAR(i, dummy); // Kp, Ki, Kd, Kc
#endif // !PIDTEMP #endif // !PIDTEMP
#if DISABLED(PID_ADD_EXTRUSION_RATE) #if DISABLED(PID_ADD_EXTRUSION_RATE)
@ -522,7 +523,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, volumetric_enabled); EEPROM_READ_VAR(i, volumetric_enabled);
for (uint8_t q = 0; q < 4; q++) { for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
EEPROM_READ_VAR(i, dummy); EEPROM_READ_VAR(i, dummy);
if (q < EXTRUDERS) filament_size[q] = dummy; if (q < EXTRUDERS) filament_size[q] = dummy;
} }