Prettify some EEPROM code
This commit is contained in:
parent
d6aa127c76
commit
c07bbd4154
|
@ -292,7 +292,7 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_WRITE(ver); // invalidate data first
|
||||
EEPROM_SKIP(working_crc); // Skip the checksum slot
|
||||
|
||||
working_crc = 0; // clear before first "real data"
|
||||
working_crc = 0; // Init to 0. Accumulated by EEPROM_READ
|
||||
|
||||
const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
|
||||
EEPROM_WRITE(esteppers);
|
||||
|
@ -699,6 +699,10 @@ void MarlinSettings::postprocess() {
|
|||
uint8_t esteppers;
|
||||
EEPROM_READ(esteppers);
|
||||
|
||||
//
|
||||
// Planner Motion
|
||||
//
|
||||
|
||||
// Get only the number of E stepper parameters previously stored
|
||||
// Any steppers added later are set to their defaults
|
||||
const float def1[] = DEFAULT_AXIS_STEPS_PER_UNIT, def2[] = DEFAULT_MAX_FEEDRATE;
|
||||
|
@ -722,6 +726,10 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_READ(planner.min_segment_time_us);
|
||||
EEPROM_READ(planner.max_jerk);
|
||||
|
||||
//
|
||||
// Home Offset (M206)
|
||||
//
|
||||
|
||||
#if !HAS_HOME_OFFSET
|
||||
float home_offset[XYZ];
|
||||
#endif
|
||||
|
@ -733,6 +741,10 @@ void MarlinSettings::postprocess() {
|
|||
home_offset[Z_AXIS] -= DELTA_HEIGHT;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Hotend Offsets, if any
|
||||
//
|
||||
|
||||
#if HOTENDS > 1
|
||||
// Skip hotend 0 which must be 0
|
||||
for (uint8_t e = 1; e < HOTENDS; e++)
|
||||
|
@ -816,6 +828,10 @@ void MarlinSettings::postprocess() {
|
|||
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);
|
||||
}
|
||||
|
||||
//
|
||||
// Unified Bed Leveling active state
|
||||
//
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
EEPROM_READ(planner.leveling_active);
|
||||
EEPROM_READ(ubl.storage_slot);
|
||||
|
@ -825,6 +841,10 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_READ(dummyui8);
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
||||
//
|
||||
// DELTA Geometry or Dual Endstops offsets
|
||||
//
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
EEPROM_READ(delta_endstop_adj); // 3 floats
|
||||
EEPROM_READ(delta_radius); // 1 float
|
||||
|
@ -861,19 +881,27 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
#endif
|
||||
|
||||
//
|
||||
// LCD Preheat settings
|
||||
//
|
||||
|
||||
#if DISABLED(ULTIPANEL)
|
||||
int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
|
||||
#endif
|
||||
|
||||
EEPROM_READ(lcd_preheat_hotend_temp);
|
||||
EEPROM_READ(lcd_preheat_bed_temp);
|
||||
EEPROM_READ(lcd_preheat_fan_speed);
|
||||
EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
|
||||
EEPROM_READ(lcd_preheat_bed_temp); // 2 floats
|
||||
EEPROM_READ(lcd_preheat_fan_speed); // 2 floats
|
||||
|
||||
//EEPROM_ASSERT(
|
||||
// WITHIN(lcd_preheat_fan_speed, 0, 255),
|
||||
// "lcd_preheat_fan_speed out of range"
|
||||
//);
|
||||
|
||||
//
|
||||
// Hotend PID
|
||||
//
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
|
||||
EEPROM_READ(dummy); // Kp
|
||||
|
@ -897,11 +925,19 @@ void MarlinSettings::postprocess() {
|
|||
for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
|
||||
#endif // !PIDTEMP
|
||||
|
||||
//
|
||||
// PID Extrusion Scaling
|
||||
//
|
||||
|
||||
#if DISABLED(PID_EXTRUSION_SCALING)
|
||||
int lpq_len;
|
||||
#endif
|
||||
EEPROM_READ(lpq_len);
|
||||
|
||||
//
|
||||
// Heated Bed PID
|
||||
//
|
||||
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
EEPROM_READ(dummy); // bedKp
|
||||
if (dummy != DUMMY_PID_VALUE) {
|
||||
|
@ -913,11 +949,19 @@ void MarlinSettings::postprocess() {
|
|||
for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
|
||||
#endif
|
||||
|
||||
//
|
||||
// LCD Contrast
|
||||
//
|
||||
|
||||
#if !HAS_LCD_CONTRAST
|
||||
uint16_t lcd_contrast;
|
||||
#endif
|
||||
EEPROM_READ(lcd_contrast);
|
||||
|
||||
//
|
||||
// Firmware Retraction
|
||||
//
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
EEPROM_READ(fwretract.autoretract_enabled);
|
||||
EEPROM_READ(fwretract.retract_length);
|
||||
|
@ -933,13 +977,20 @@ void MarlinSettings::postprocess() {
|
|||
for (uint8_t q=8; q--;) EEPROM_READ(dummy);
|
||||
#endif
|
||||
|
||||
EEPROM_READ(parser.volumetric_enabled);
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
|
||||
EEPROM_READ(parser.volumetric_enabled);
|
||||
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
||||
EEPROM_READ(dummy);
|
||||
if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
|
||||
}
|
||||
|
||||
//
|
||||
// TMC2130 Stepper Current
|
||||
//
|
||||
|
||||
uint16_t val;
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
EEPROM_READ(val);
|
||||
|
@ -987,7 +1038,7 @@ void MarlinSettings::postprocess() {
|
|||
stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
||||
#endif
|
||||
#else
|
||||
for (uint8_t q = 0; q < 11; q++) EEPROM_READ(val);
|
||||
for (uint8_t q = 11; q--;) EEPROM_READ(val);
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@ -1002,6 +1053,10 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_READ(dummy);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Motor Current PWM
|
||||
//
|
||||
|
||||
#if HAS_MOTOR_CURRENT_PWM
|
||||
for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue