Browse Source

Always report position on config load/reset

pull/1/head
Scott Lahteine 7 years ago
parent
commit
6686d937fb
  1. 37
      Marlin/src/module/configuration_store.cpp

37
Marlin/src/module/configuration_store.cpp

@ -216,14 +216,15 @@ MarlinSettings settings;
float new_z_fade_height; float new_z_fade_height;
#endif #endif
#if ENABLED(CNC_COORDINATE_SYSTEMS)
bool position_changed;
#endif
/** /**
* Post-process after Retrieve or Reset * Post-process after Retrieve or Reset
*/ */
void MarlinSettings::postprocess() { void MarlinSettings::postprocess() {
const float oldpos[XYZE] = {
current_position[X_AXIS], current_position[Y_AXIS],
current_position[Z_AXIS], current_position[E_AXIS]
};
// steps per s2 needs to be updated to agree with units per s2 // steps per s2 needs to be updated to agree with units per s2
planner.reset_acceleration_rates(); planner.reset_acceleration_rates();
@ -233,10 +234,6 @@ void MarlinSettings::postprocess() {
recalc_delta_settings(); recalc_delta_settings();
#endif #endif
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
// and init stepper.count[], planner.position[] with current_position
planner.refresh_positioning();
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
thermalManager.updatePID(); thermalManager.updatePID();
#endif #endif
@ -249,7 +246,7 @@ void MarlinSettings::postprocess() {
#endif #endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
set_z_fade_height(new_z_fade_height); set_z_fade_height(new_z_fade_height, false); // false = no report
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@ -265,12 +262,13 @@ void MarlinSettings::postprocess() {
fwretract.refresh_autoretract(); fwretract.refresh_autoretract();
#endif #endif
#if ENABLED(CNC_COORDINATE_SYSTEMS) // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
if (position_changed) { // and init stepper.count[], planner.position[] with current_position
report_current_position(); planner.refresh_positioning();
position_changed = false;
} // Various factors can change the current position
#endif if (memcmp(oldpos, current_position, sizeof(oldpos)))
report_current_position();
} }
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
@ -308,7 +306,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(ver); // invalidate data first EEPROM_WRITE(ver); // invalidate data first
EEPROM_SKIP(working_crc); // Skip the checksum slot EEPROM_SKIP(working_crc); // Skip the checksum slot
working_crc = 0; // Init to 0. Accumulated by EEPROM_READ working_crc = 0; // clear before first "real data"
const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ; const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
EEPROM_WRITE(esteppers); EEPROM_WRITE(esteppers);
@ -342,7 +340,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float zfh = planner.z_fade_height; const float zfh = planner.z_fade_height;
#else #else
const float zfh = 0.0; const float zfh = 10.0;
#endif #endif
EEPROM_WRITE(zfh); EEPROM_WRITE(zfh);
@ -725,7 +723,7 @@ void MarlinSettings::postprocess() {
float dummy = 0; float dummy = 0;
bool dummyb; bool dummyb;
working_crc = 0; //clear before reading first "real data" working_crc = 0; // Init to 0. Accumulated by EEPROM_READ
// Number of esteppers may change // Number of esteppers may change
uint8_t esteppers; uint8_t esteppers;
@ -913,7 +911,6 @@ void MarlinSettings::postprocess() {
#if DISABLED(ULTIPANEL) #if DISABLED(ULTIPANEL)
int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#endif #endif
EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
EEPROM_READ(lcd_preheat_bed_temp); // 2 floats EEPROM_READ(lcd_preheat_bed_temp); // 2 floats
EEPROM_READ(lcd_preheat_fan_speed); // 2 floats EEPROM_READ(lcd_preheat_fan_speed); // 2 floats
@ -1094,7 +1091,7 @@ void MarlinSettings::postprocess() {
// //
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if ENABLED(CNC_COORDINATE_SYSTEMS)
position_changed = gcode.select_coordinate_system(-1); // Go back to machine space (void)gcode.select_coordinate_system(-1); // Go back to machine space
EEPROM_READ(gcode.coordinate_system); // 27 floats EEPROM_READ(gcode.coordinate_system); // 27 floats
#else #else
for (uint8_t q = 27; q--;) EEPROM_READ(dummy); for (uint8_t q = 27; q--;) EEPROM_READ(dummy);

Loading…
Cancel
Save