Pārlūkot izejas kodu

Merge pull request #4709 from thinkyhead/rc_log_the_reason

Log whether homing with probe or endstop
Scott Lahteine 8 gadus atpakaļ
vecāks
revīzija
8e9ac72191
1 mainītis faili ar 44 papildinājumiem un 46 dzēšanām
  1. 44
    46
      Marlin/Marlin_main.cpp

+ 44
- 46
Marlin/Marlin_main.cpp Parādīt failu

@@ -1395,8 +1395,7 @@ bool get_target_extruder_from_command(int code) {
1395 1395
       SERIAL_ECHO_START;
1396 1396
       SERIAL_CHAR('M');
1397 1397
       SERIAL_ECHO(code);
1398
-      SERIAL_ECHOPAIR(" " MSG_INVALID_EXTRUDER " ", code_value_byte());
1399
-      SERIAL_EOL;
1398
+      SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", code_value_byte());
1400 1399
       return true;
1401 1400
     }
1402 1401
     target_extruder = code_value_byte();
@@ -1504,8 +1503,7 @@ void update_software_endstops(AxisEnum axis) {
1504 1503
       SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
1505 1504
       SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
1506 1505
       SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
1507
-      SERIAL_ECHOPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
1508
-      SERIAL_EOL;
1506
+      SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
1509 1507
     }
1510 1508
   #endif
1511 1509
 
@@ -1586,23 +1584,42 @@ static void set_axis_is_at_home(AxisEnum axis) {
1586 1584
     current_position[axis] = LOGICAL_POSITION(base_home_pos(axis), axis);
1587 1585
     update_software_endstops(axis);
1588 1586
 
1587
+    if (axis == Z_AXIS) {
1588
+      #if HAS_BED_PROBE && Z_HOME_DIR < 0
1589
+        #if DISABLED(Z_MIN_PROBE_ENDSTOP)
1590
+          current_position[Z_AXIS] -= zprobe_zoffset;
1591
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
1592
+            if (DEBUGGING(LEVELING)) {
1593
+              SERIAL_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***");
1594
+              SERIAL_ECHOLNPAIR("> zprobe_zoffset = ", zprobe_zoffset);
1595
+            }
1596
+          #endif
1597
+        #elif ENABLED(DEBUG_LEVELING_FEATURE)
1598
+          if (DEBUGGING(LEVELING))
1599
+            SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP (Z_MIN_PROBE_ENDSTOP) ***");
1600
+        #endif
1601
+      #endif
1602
+    }
1603
+
1589 1604
     #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP)
1590 1605
       if (axis == Z_AXIS) {
1591 1606
         current_position[Z_AXIS] -= zprobe_zoffset;
1592 1607
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1593 1608
           if (DEBUGGING(LEVELING)) {
1594
-            SERIAL_ECHOPAIR("> zprobe_zoffset = ", zprobe_zoffset);
1595
-            SERIAL_EOL;
1609
+            SERIAL_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***");
1610
+            SERIAL_ECHOLNPAIR("> zprobe_zoffset = ", zprobe_zoffset);
1596 1611
           }
1597 1612
         #endif
1598 1613
       }
1614
+    #elif HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(DEBUG_LEVELING_FEATURE)
1615
+      if (DEBUGGING(LEVELING))
1616
+        SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP (Z_MIN_PROBE_ENDSTOP) ***");
1599 1617
     #endif
1600 1618
 
1601 1619
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1602 1620
       if (DEBUGGING(LEVELING)) {
1603 1621
         SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]);
1604
-        SERIAL_ECHOPAIR("] = ", home_offset[axis]);
1605
-        SERIAL_EOL;
1622
+        SERIAL_ECHOLNPAIR("] = ", home_offset[axis]);
1606 1623
         DEBUG_POS("", current_position);
1607 1624
       }
1608 1625
     #endif
@@ -2054,8 +2071,7 @@ static void clean_up_after_endstop_or_probe_move() {
2054 2071
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2055 2072
       if (DEBUGGING(LEVELING)) {
2056 2073
         DEBUG_POS("set_probe_deployed", current_position);
2057
-        SERIAL_ECHOPAIR("deploy: ", deploy);
2058
-        SERIAL_EOL;
2074
+        SERIAL_ECHOLNPAIR("deploy: ", deploy);
2059 2075
       }
2060 2076
     #endif
2061 2077
 
@@ -3029,10 +3045,8 @@ inline void gcode_G28() {
3029 3045
         if (destination[Z_AXIS] > current_position[Z_AXIS]) {
3030 3046
 
3031 3047
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3032
-            if (DEBUGGING(LEVELING)) {
3033
-              SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
3034
-              SERIAL_EOL;
3035
-            }
3048
+            if (DEBUGGING(LEVELING))
3049
+              SERIAL_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
3036 3050
           #endif
3037 3051
 
3038 3052
           do_blocking_move_to_z(destination[Z_AXIS]);
@@ -3842,8 +3856,7 @@ inline void gcode_G28() {
3842 3856
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3843 3857
           if (DEBUGGING(LEVELING)) {
3844 3858
             SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z);
3845
-            SERIAL_ECHOPAIR(" ... z_tmp  = ", z_tmp);
3846
-            SERIAL_EOL;
3859
+            SERIAL_ECHOLNPAIR(" ... z_tmp  = ", z_tmp);
3847 3860
           }
3848 3861
         #endif
3849 3862
 
@@ -3851,10 +3864,8 @@ inline void gcode_G28() {
3851 3864
         apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
3852 3865
 
3853 3866
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3854
-          if (DEBUGGING(LEVELING)) {
3855
-            SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp  = ", z_tmp);
3856
-            SERIAL_EOL;
3857
-          }
3867
+          if (DEBUGGING(LEVELING))
3868
+            SERIAL_ECHOLNPAIR("> AFTER apply_rotation_xyz > z_tmp  = ", z_tmp);
3858 3869
         #endif
3859 3870
 
3860 3871
         // Adjust the current Z and send it to the planner.
@@ -4380,8 +4391,7 @@ inline void gcode_M42() {
4380 4391
               Y_current /= 1.25;
4381 4392
               if (verbose_level > 3) {
4382 4393
                 SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
4383
-                SERIAL_ECHOPAIR(", ", Y_current);
4384
-                SERIAL_EOL;
4394
+                SERIAL_ECHOLNPAIR(", ", Y_current);
4385 4395
               }
4386 4396
             }
4387 4397
           #endif
@@ -4389,8 +4399,7 @@ inline void gcode_M42() {
4389 4399
             SERIAL_PROTOCOLPGM("Going to:");
4390 4400
             SERIAL_ECHOPAIR(" X", X_current);
4391 4401
             SERIAL_ECHOPAIR(" Y", Y_current);
4392
-            SERIAL_ECHOPAIR(" Z", current_position[Z_AXIS]);
4393
-            SERIAL_EOL;
4402
+            SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
4394 4403
           }
4395 4404
           do_blocking_move_to_xy(X_current, Y_current);
4396 4405
         } // n_legs loop
@@ -4948,8 +4957,7 @@ inline void gcode_M111() {
4948 4957
     }
4949 4958
     else {
4950 4959
       SERIAL_ECHO_START;
4951
-      SERIAL_ECHOPAIR("M113 S", (unsigned long)host_keepalive_interval);
4952
-      SERIAL_EOL;
4960
+      SERIAL_ECHOLNPAIR("M113 S", (unsigned long)host_keepalive_interval);
4953 4961
     }
4954 4962
   }
4955 4963
 
@@ -5399,23 +5407,19 @@ inline void gcode_M203() {
5399 5407
 inline void gcode_M204() {
5400 5408
   if (code_seen('S')) {  // Kept for legacy compatibility. Should NOT BE USED for new developments.
5401 5409
     planner.travel_acceleration = planner.acceleration = code_value_linear_units();
5402
-    SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
5403
-    SERIAL_EOL;
5410
+    SERIAL_ECHOLNPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
5404 5411
   }
5405 5412
   if (code_seen('P')) {
5406 5413
     planner.acceleration = code_value_linear_units();
5407
-    SERIAL_ECHOPAIR("Setting Print Acceleration: ", planner.acceleration);
5408
-    SERIAL_EOL;
5414
+    SERIAL_ECHOLNPAIR("Setting Print Acceleration: ", planner.acceleration);
5409 5415
   }
5410 5416
   if (code_seen('R')) {
5411 5417
     planner.retract_acceleration = code_value_linear_units();
5412
-    SERIAL_ECHOPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
5413
-    SERIAL_EOL;
5418
+    SERIAL_ECHOLNPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
5414 5419
   }
5415 5420
   if (code_seen('T')) {
5416 5421
     planner.travel_acceleration = code_value_linear_units();
5417
-    SERIAL_ECHOPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
5418
-    SERIAL_EOL;
5422
+    SERIAL_ECHOLNPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
5419 5423
   }
5420 5424
 }
5421 5425
 
@@ -5491,8 +5495,7 @@ inline void gcode_M206() {
5491 5495
           if (DEBUGGING(LEVELING)) {
5492 5496
             SERIAL_ECHOPGM("endstop_adj[");
5493 5497
             SERIAL_ECHO(axis_codes[i]);
5494
-            SERIAL_ECHOPAIR("] = ", endstop_adj[i]);
5495
-            SERIAL_EOL;
5498
+            SERIAL_ECHOLNPAIR("] = ", endstop_adj[i]);
5496 5499
           }
5497 5500
         #endif
5498 5501
       }
@@ -5511,8 +5514,7 @@ inline void gcode_M206() {
5511 5514
    */
5512 5515
   inline void gcode_M666() {
5513 5516
     if (code_seen('Z')) z_endstop_adj = code_value_axis_units(Z_AXIS);
5514
-    SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
5515
-    SERIAL_EOL;
5517
+    SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
5516 5518
   }
5517 5519
 
5518 5520
 #endif // !DELTA && Z_DUAL_ENDSTOPS
@@ -5587,8 +5589,7 @@ inline void gcode_M211() {
5587 5589
   SERIAL_ECHOPGM("  " MSG_SOFT_MAX ": ");
5588 5590
   SERIAL_ECHOPAIR(    MSG_X, soft_endstop_max[X_AXIS]);
5589 5591
   SERIAL_ECHOPAIR(" " MSG_Y, soft_endstop_max[Y_AXIS]);
5590
-  SERIAL_ECHOPAIR(" " MSG_Z, soft_endstop_max[Z_AXIS]);
5591
-  SERIAL_EOL;
5592
+  SERIAL_ECHOLNPAIR(" " MSG_Z, soft_endstop_max[Z_AXIS]);
5592 5593
 }
5593 5594
 
5594 5595
 #if HOTENDS > 1
@@ -6822,8 +6823,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
6822 6823
 
6823 6824
           #if ENABLED(DEBUG_LEVELING_FEATURE)
6824 6825
             if (DEBUGGING(LEVELING)) {
6825
-              SERIAL_ECHOPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
6826
-              SERIAL_EOL;
6826
+              SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
6827 6827
               DEBUG_POS("New extruder (parked)", current_position);
6828 6828
             }
6829 6829
           #endif
@@ -6932,10 +6932,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
6932 6932
                       ypos = RAW_CURRENT_POSITION(Y_AXIS);
6933 6933
                 current_position[Z_AXIS] += mbl.get_z(xpos + xydiff[X_AXIS], ypos + xydiff[Y_AXIS]) - mbl.get_z(xpos, ypos);
6934 6934
                 #if ENABLED(DEBUG_LEVELING_FEATURE)
6935
-                  if (DEBUGGING(LEVELING)) {
6936
-                    SERIAL_ECHOPAIR(" after: ", current_position[Z_AXIS]);
6937
-                    SERIAL_EOL;
6938
-                  }
6935
+                  if (DEBUGGING(LEVELING))
6936
+                    SERIAL_ECHOLNPAIR(" after: ", current_position[Z_AXIS]);
6939 6937
                 #endif
6940 6938
               }
6941 6939
 

Notiek ielāde…
Atcelt
Saglabāt