瀏覽代碼

Have M420 report a changed position

Scott Lahteine 7 年之前
父節點
當前提交
aa1b4eded6
共有 1 個檔案被更改,包括 14 行新增14 行删除
  1. 14
    14
      Marlin/Marlin_main.cpp

+ 14
- 14
Marlin/Marlin_main.cpp 查看文件

@@ -340,11 +340,6 @@
340 340
   #include "ubl.h"
341 341
   extern bool defer_return_to_status;
342 342
   unified_bed_leveling ubl;
343
-  #define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \
344
-                           && ubl.z_values[1][0] == ubl.z_values[1][1] && ubl.z_values[1][1] == ubl.z_values[1][2] \
345
-                           && ubl.z_values[2][0] == ubl.z_values[2][1] && ubl.z_values[2][1] == ubl.z_values[2][2] \
346
-                           && ubl.z_values[0][0] == 0 && ubl.z_values[1][0] == 0 && ubl.z_values[2][0] == 0 )  \
347
-                           || isnan(ubl.z_values[0][0]))
348 343
 #endif
349 344
 
350 345
 #if ENABLED(CNC_COORDINATE_SYSTEMS)
@@ -2490,10 +2485,7 @@ static void clean_up_after_endstop_or_probe_move() {
2490 2485
       planner.set_z_fade_height(zfh);
2491 2486
 
2492 2487
       if (level_active) {
2493
-        const float oldpos[XYZE] = {
2494
-          current_position[X_AXIS], current_position[Y_AXIS],
2495
-          current_position[Z_AXIS], current_position[E_AXIS]
2496
-        };
2488
+        const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
2497 2489
         #if ENABLED(AUTO_BED_LEVELING_UBL)
2498 2490
           set_bed_leveling_enabled(true);  // turn back on after changing fade height
2499 2491
         #else
@@ -9616,6 +9608,8 @@ void quickstop_stepper() {
9616 9608
    */
9617 9609
   inline void gcode_M420() {
9618 9610
 
9611
+    const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
9612
+
9619 9613
     #if ENABLED(AUTO_BED_LEVELING_UBL)
9620 9614
 
9621 9615
       // L to load a mesh from the EEPROM
@@ -9650,7 +9644,7 @@ void quickstop_stepper() {
9650 9644
       // L to load a mesh from the EEPROM
9651 9645
       if (parser.seen('L') || parser.seen('V')) {
9652 9646
         ubl.display_map(0);  // Currently only supports one map type
9653
-        SERIAL_ECHOLNPAIR("UBL_MESH_VALID = ", UBL_MESH_VALID);
9647
+        SERIAL_ECHOLNPAIR("ubl.mesh_is_valid = ", ubl.mesh_is_valid());
9654 9648
         SERIAL_ECHOLNPAIR("ubl.storage_slot = ", ubl.storage_slot);
9655 9649
       }
9656 9650
 
@@ -9675,14 +9669,16 @@ void quickstop_stepper() {
9675 9669
       #endif
9676 9670
     }
9677 9671
 
9678
-    const bool to_enable = parser.boolval('S');
9679
-    if (parser.seen('S'))
9680
-      set_bed_leveling_enabled(to_enable);
9681
-
9682 9672
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
9683 9673
       if (parser.seen('Z')) set_z_fade_height(parser.value_linear_units(), false);
9684 9674
     #endif
9685 9675
 
9676
+    bool to_enable = false;
9677
+    if (parser.seen('S')) {
9678
+      to_enable = parser.value_bool();
9679
+      set_bed_leveling_enabled(to_enable);
9680
+    }
9681
+
9686 9682
     const bool new_status = planner.leveling_active;
9687 9683
 
9688 9684
     if (to_enable && !new_status) {
@@ -9701,6 +9697,10 @@ void quickstop_stepper() {
9701 9697
       else
9702 9698
         SERIAL_ECHOLNPGM(MSG_OFF);
9703 9699
     #endif
9700
+
9701
+    // Report change in position
9702
+    if (memcmp(oldpos, current_position, sizeof(oldpos)))
9703
+      report_current_position();
9704 9704
   }
9705 9705
 #endif
9706 9706
 

Loading…
取消
儲存