Przeglądaj źródła

Always report position on config load/reset

Scott Lahteine 7 lat temu
rodzic
commit
ccca1ade2d
3 zmienionych plików z 16 dodań i 18 usunięć
  1. 1
    1
      Marlin/Marlin.h
  2. 4
    1
      Marlin/Marlin_main.cpp
  3. 11
    16
      Marlin/configuration_store.cpp

+ 1
- 1
Marlin/Marlin.h Wyświetl plik

@@ -373,7 +373,7 @@ void report_current_position();
373 373
 #endif
374 374
 
375 375
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
376
-  void set_z_fade_height(const float zfh);
376
+  void set_z_fade_height(const float zfh, const bool do_report=true);
377 377
 #endif
378 378
 
379 379
 #if ENABLED(X_DUAL_ENDSTOPS)

+ 4
- 1
Marlin/Marlin_main.cpp Wyświetl plik

@@ -2475,7 +2475,9 @@ static void clean_up_after_endstop_or_probe_move() {
2475 2475
 
2476 2476
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2477 2477
 
2478
-    void set_z_fade_height(const float zfh) {
2478
+    void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
2479
+
2480
+      if (planner.z_fade_height == zfh) return; // do nothing if no change
2479 2481
 
2480 2482
       const bool level_active = planner.leveling_active;
2481 2483
 
@@ -2497,6 +2499,7 @@ static void clean_up_after_endstop_or_probe_move() {
2497 2499
             #endif
2498 2500
           );
2499 2501
         #endif
2502
+        if (do_report) report_current_position();
2500 2503
       }
2501 2504
     }
2502 2505
 

+ 11
- 16
Marlin/configuration_store.cpp Wyświetl plik

@@ -215,14 +215,12 @@ MarlinSettings settings;
215 215
   float new_z_fade_height;
216 216
 #endif
217 217
 
218
-#if ENABLED(CNC_COORDINATE_SYSTEMS)
219
-  bool position_changed;
220
-#endif
221
-
222 218
 /**
223 219
  * Post-process after Retrieve or Reset
224 220
  */
225 221
 void MarlinSettings::postprocess() {
222
+  const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
223
+
226 224
   // steps per s2 needs to be updated to agree with units per s2
227 225
   planner.reset_acceleration_rates();
228 226
 
@@ -232,10 +230,6 @@ void MarlinSettings::postprocess() {
232 230
     recalc_delta_settings();
233 231
   #endif
234 232
 
235
-  // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
236
-  // and init stepper.count[], planner.position[] with current_position
237
-  planner.refresh_positioning();
238
-
239 233
   #if ENABLED(PIDTEMP)
240 234
     thermalManager.updatePID();
241 235
   #endif
@@ -248,7 +242,7 @@ void MarlinSettings::postprocess() {
248 242
   #endif
249 243
 
250 244
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
251
-    set_z_fade_height(new_z_fade_height);
245
+    set_z_fade_height(new_z_fade_height, false); // false = no report
252 246
   #endif
253 247
 
254 248
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -260,12 +254,13 @@ void MarlinSettings::postprocess() {
260 254
     stepper.refresh_motor_power();
261 255
   #endif
262 256
 
263
-  #if ENABLED(CNC_COORDINATE_SYSTEMS)
264
-    if (position_changed) {
265
-      report_current_position();
266
-      position_changed = false;
267
-    }
268
-  #endif
257
+  // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
258
+  // and init stepper.count[], planner.position[] with current_position
259
+  planner.refresh_positioning();
260
+
261
+  // Various factors can change the current position
262
+  if (memcmp(oldpos, current_position, sizeof(oldpos)))
263
+    report_current_position();
269 264
 }
270 265
 
271 266
 #if ENABLED(EEPROM_SETTINGS)
@@ -1121,7 +1116,7 @@ void MarlinSettings::postprocess() {
1121 1116
       //
1122 1117
 
1123 1118
       #if ENABLED(CNC_COORDINATE_SYSTEMS)
1124
-        position_changed = select_coordinate_system(-1); // Go back to machine space
1119
+        (void)select_coordinate_system(-1); // Go back to machine space
1125 1120
         EEPROM_READ(coordinate_system);                  // 27 floats
1126 1121
       #else
1127 1122
         for (uint8_t q = 27; q--;) EEPROM_READ(dummy);

Ładowanie…
Anuluj
Zapisz