Просмотр исходного кода

Always report position on config load/reset

Scott Lahteine 7 лет назад
Родитель
Сommit
6686d937fb
1 измененных файлов: 17 добавлений и 20 удалений
  1. 17
    20
      Marlin/src/module/configuration_store.cpp

+ 17
- 20
Marlin/src/module/configuration_store.cpp Просмотреть файл

@@ -216,14 +216,15 @@ MarlinSettings settings;
216 216
   float new_z_fade_height;
217 217
 #endif
218 218
 
219
-#if ENABLED(CNC_COORDINATE_SYSTEMS)
220
-  bool position_changed;
221
-#endif
222
-
223 219
 /**
224 220
  * Post-process after Retrieve or Reset
225 221
  */
226 222
 void MarlinSettings::postprocess() {
223
+  const float oldpos[XYZE] = {
224
+    current_position[X_AXIS], current_position[Y_AXIS],
225
+    current_position[Z_AXIS], current_position[E_AXIS]
226
+  };
227
+
227 228
   // steps per s2 needs to be updated to agree with units per s2
228 229
   planner.reset_acceleration_rates();
229 230
 
@@ -233,10 +234,6 @@ void MarlinSettings::postprocess() {
233 234
     recalc_delta_settings();
234 235
   #endif
235 236
 
236
-  // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
237
-  // and init stepper.count[], planner.position[] with current_position
238
-  planner.refresh_positioning();
239
-
240 237
   #if ENABLED(PIDTEMP)
241 238
     thermalManager.updatePID();
242 239
   #endif
@@ -249,7 +246,7 @@ void MarlinSettings::postprocess() {
249 246
   #endif
250 247
 
251 248
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
252
-    set_z_fade_height(new_z_fade_height);
249
+    set_z_fade_height(new_z_fade_height, false); // false = no report
253 250
   #endif
254 251
 
255 252
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -264,13 +261,14 @@ void MarlinSettings::postprocess() {
264 261
   #if ENABLED(FWRETRACT)
265 262
     fwretract.refresh_autoretract();
266 263
   #endif
264
+ 
265
+  // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
266
+  // and init stepper.count[], planner.position[] with current_position
267
+  planner.refresh_positioning();
267 268
 
268
-  #if ENABLED(CNC_COORDINATE_SYSTEMS)
269
-    if (position_changed) {
270
-      report_current_position();
271
-      position_changed = false;
272
-    }
273
-  #endif
269
+  // Various factors can change the current position
270
+  if (memcmp(oldpos, current_position, sizeof(oldpos)))
271
+    report_current_position();
274 272
 }
275 273
 
276 274
 #if ENABLED(EEPROM_SETTINGS)
@@ -308,7 +306,7 @@ void MarlinSettings::postprocess() {
308 306
     EEPROM_WRITE(ver);     // invalidate data first
309 307
     EEPROM_SKIP(working_crc); // Skip the checksum slot
310 308
 
311
-    working_crc = 0;  // Init to 0. Accumulated by EEPROM_READ
309
+    working_crc = 0; // clear before first "real data"
312 310
 
313 311
     const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
314 312
     EEPROM_WRITE(esteppers);
@@ -342,7 +340,7 @@ void MarlinSettings::postprocess() {
342 340
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
343 341
       const float zfh = planner.z_fade_height;
344 342
     #else
345
-      const float zfh = 0.0;
343
+      const float zfh = 10.0;
346 344
     #endif
347 345
     EEPROM_WRITE(zfh);
348 346
 
@@ -725,7 +723,7 @@ void MarlinSettings::postprocess() {
725 723
       float dummy = 0;
726 724
       bool dummyb;
727 725
 
728
-      working_crc = 0; //clear before reading first "real data"
726
+      working_crc = 0;  // Init to 0. Accumulated by EEPROM_READ
729 727
 
730 728
       // Number of esteppers may change
731 729
       uint8_t esteppers;
@@ -913,7 +911,6 @@ void MarlinSettings::postprocess() {
913 911
       #if DISABLED(ULTIPANEL)
914 912
         int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
915 913
       #endif
916
-
917 914
       EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
918 915
       EEPROM_READ(lcd_preheat_bed_temp);    // 2 floats
919 916
       EEPROM_READ(lcd_preheat_fan_speed);   // 2 floats
@@ -1094,7 +1091,7 @@ void MarlinSettings::postprocess() {
1094 1091
       //
1095 1092
 
1096 1093
       #if ENABLED(CNC_COORDINATE_SYSTEMS)
1097
-        position_changed = gcode.select_coordinate_system(-1); // Go back to machine space
1094
+        (void)gcode.select_coordinate_system(-1); // Go back to machine space
1098 1095
         EEPROM_READ(gcode.coordinate_system);                  // 27 floats
1099 1096
       #else
1100 1097
         for (uint8_t q = 27; q--;) EEPROM_READ(dummy);

Загрузка…
Отмена
Сохранить