瀏覽代碼

Split up endstop_move functions

Scott Lahteine 9 年之前
父節點
當前提交
e69916d1bd
共有 1 個文件被更改,包括 21 次插入15 次删除
  1. 21
    15
      Marlin/Marlin_main.cpp

+ 21
- 15
Marlin/Marlin_main.cpp 查看文件

@@ -1582,34 +1582,40 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1582 1582
 //
1583 1583
 //  - Save current feedrates
1584 1584
 //  - Reset the rate multiplier
1585
-//  - Enable the endstops
1586 1585
 //  - Reset the command timeout
1586
+//  - Enable the endstops (for endstop moves)
1587 1587
 //
1588 1588
 // clean_up_after_endstop_move() restores
1589 1589
 // feedrates, sets endstops back to global state.
1590 1590
 //
1591
-static void setup_for_endstop_move() {
1591
+static void setup_for_endstop_or_probe_move() {
1592
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
1593
+    if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
1594
+  #endif
1592 1595
   saved_feedrate = feedrate;
1593 1596
   saved_feedrate_multiplier = feedrate_multiplier;
1594 1597
   feedrate_multiplier = 100;
1595 1598
   refresh_cmd_timeout();
1596
-  #if ENABLED(DEBUG_LEVELING_FEATURE)
1597
-    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("setup_for_endstop_move > endstops.enable()");
1598
-  #endif
1599
+}
1600
+static void setup_for_endstop_move() {
1601
+  setup_for_endstop_or_probe_move();
1599 1602
   endstops.enable();
1600 1603
 }
1601 1604
 
1602 1605
 #if HAS_BED_PROBE
1603 1606
 
1604
-  static void clean_up_after_endstop_move() {
1607
+  static void clean_up_after_endstop_or_probe_move() {
1605 1608
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1606
-      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("clean_up_after_endstop_move > endstops.not_homing()");
1609
+      if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
1607 1610
     #endif
1608
-    endstops.not_homing();
1609 1611
     feedrate = saved_feedrate;
1610 1612
     feedrate_multiplier = saved_feedrate_multiplier;
1611 1613
     refresh_cmd_timeout();
1612 1614
   }
1615
+  static void clean_up_after_endstop_move() {
1616
+    clean_up_after_endstop_or_probe_move();
1617
+    endstops.not_homing();
1618
+  }
1613 1619
 
1614 1620
   #if ENABLED(DELTA)
1615 1621
     /**
@@ -3475,7 +3481,7 @@ inline void gcode_G28() {
3475 3481
 
3476 3482
     stepper.synchronize();
3477 3483
 
3478
-    setup_for_endstop_move();
3484
+    setup_for_endstop_or_probe_move();
3479 3485
 
3480 3486
     feedrate = homing_feedrate[Z_AXIS];
3481 3487
 
@@ -3589,7 +3595,7 @@ inline void gcode_G28() {
3589 3595
         if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
3590 3596
       #endif
3591 3597
 
3592
-      clean_up_after_endstop_move();
3598
+      clean_up_after_endstop_or_probe_move();
3593 3599
 
3594 3600
       #if ENABLED(DELTA)
3595 3601
 
@@ -3715,7 +3721,7 @@ inline void gcode_G28() {
3715 3721
                                   ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3716 3722
                                   current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,
3717 3723
                                   p3, verbose_level);
3718
-      clean_up_after_endstop_move();
3724
+      clean_up_after_endstop_or_probe_move();
3719 3725
       if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3720 3726
 
3721 3727
     #endif // !AUTO_BED_LEVELING_GRID
@@ -3830,7 +3836,7 @@ inline void gcode_G28() {
3830 3836
    */
3831 3837
   inline void gcode_G30() {
3832 3838
 
3833
-    setup_for_endstop_move();
3839
+    setup_for_endstop_or_probe_move();
3834 3840
 
3835 3841
     deploy_z_probe();
3836 3842
 
@@ -3849,7 +3855,7 @@ inline void gcode_G28() {
3849 3855
 
3850 3856
     stow_z_probe();
3851 3857
 
3852
-    clean_up_after_endstop_move();
3858
+    clean_up_after_endstop_or_probe_move();
3853 3859
 
3854 3860
     report_current_position();
3855 3861
   }
@@ -4259,7 +4265,7 @@ inline void gcode_M42() {
4259 4265
      * OK, do the initial probe to get us close to the bed.
4260 4266
      * Then retrace the right amount and use that in subsequent probes
4261 4267
      */
4262
-    setup_for_endstop_move();
4268
+    setup_for_endstop_or_probe_move();
4263 4269
 
4264 4270
     // Height before each probe (except the first)
4265 4271
     float z_between = home_offset[Z_AXIS] + (deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS);
@@ -4413,7 +4419,7 @@ inline void gcode_M42() {
4413 4419
     SERIAL_PROTOCOL_F(sigma, 6);
4414 4420
     SERIAL_EOL; SERIAL_EOL;
4415 4421
 
4416
-    clean_up_after_endstop_move();
4422
+    clean_up_after_endstop_or_probe_move();
4417 4423
 
4418 4424
     report_current_position();
4419 4425
   }

Loading…
取消
儲存