Преглед изворни кода

Merge pull request #4005 from thinkyhead/rc_prepare_move_destination

Clarify names of prepare_move functions
Scott Lahteine пре 8 година
родитељ
комит
2f1bf8373b
2 измењених фајлова са 54 додато и 54 уклоњено
  1. 0
    1
      Marlin/Marlin.h
  2. 54
    53
      Marlin/Marlin_main.cpp

+ 0
- 1
Marlin/Marlin.h Прегледај датотеку

@@ -227,7 +227,6 @@ void FlushSerialRequestResend();
227 227
 void ok_to_send();
228 228
 
229 229
 void reset_bed_level();
230
-void prepare_move();
231 230
 void kill(const char*);
232 231
 
233 232
 #if DISABLED(DELTA) && DISABLED(SCARA)

+ 54
- 53
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -529,6 +529,7 @@ void stop();
529 529
 
530 530
 void get_available_commands();
531 531
 void process_next_command();
532
+void prepare_move_to_destination();
532 533
 
533 534
 #if ENABLED(ARC_SUPPORT)
534 535
   void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
@@ -1568,9 +1569,9 @@ static void setup_for_endstop_move() {
1568 1569
     /**
1569 1570
      * Calculate delta, start a line, and set current_position to destination
1570 1571
      */
1571
-    void prepare_move_raw() {
1572
+    void prepare_move_to_destination_raw() {
1572 1573
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1573
-        if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_move_raw", destination);
1574
+        if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_move_to_destination_raw", destination);
1574 1575
       #endif
1575 1576
       refresh_cmd_timeout();
1576 1577
       calculate_delta(destination);
@@ -1674,7 +1675,7 @@ static void setup_for_endstop_move() {
1674 1675
       // move down slowly until you find the bed
1675 1676
       feedrate = homing_feedrate[Z_AXIS] / 4;
1676 1677
       destination[Z_AXIS] = -10;
1677
-      prepare_move_raw(); // this will also set_current_to_destination
1678
+      prepare_move_to_destination_raw(); // this will also set_current_to_destination
1678 1679
       stepper.synchronize();
1679 1680
       endstops.hit_on_purpose(); // clear endstop hit flags
1680 1681
 
@@ -1754,9 +1755,9 @@ static void setup_for_endstop_move() {
1754 1755
       destination[Z_AXIS] = z;
1755 1756
 
1756 1757
       if (x == current_position[X_AXIS] && y == current_position[Y_AXIS])
1757
-        prepare_move_raw(); // this will also set_current_to_destination
1758
+        prepare_move_to_destination_raw(); // this will also set_current_to_destination
1758 1759
       else
1759
-        prepare_move();     // this will also set_current_to_destination
1760
+        prepare_move_to_destination();     // this will also set_current_to_destination
1760 1761
 
1761 1762
       stepper.synchronize();
1762 1763
 
@@ -1843,7 +1844,7 @@ static void setup_for_endstop_move() {
1843 1844
           destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X;
1844 1845
           destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y;
1845 1846
           destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Z;
1846
-          prepare_move_raw(); // this will also set_current_to_destination
1847
+          prepare_move_to_destination_raw(); // this will also set_current_to_destination
1847 1848
 
1848 1849
           // Move to engage deployment
1849 1850
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE)
@@ -1854,7 +1855,7 @@ static void setup_for_endstop_move() {
1854 1855
             destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y;
1855 1856
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
1856 1857
             destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z;
1857
-          prepare_move_raw();
1858
+          prepare_move_to_destination_raw();
1858 1859
 
1859 1860
           #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
1860 1861
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)
@@ -1870,14 +1871,14 @@ static void setup_for_endstop_move() {
1870 1871
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z)
1871 1872
               destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z;
1872 1873
 
1873
-            prepare_move_raw();
1874
+            prepare_move_to_destination_raw();
1874 1875
           #endif
1875 1876
         }
1876 1877
 
1877 1878
       // Partially Home X,Y for safety
1878 1879
       destination[X_AXIS] = destination[X_AXIS] * 0.75;
1879 1880
       destination[Y_AXIS] = destination[Y_AXIS] * 0.75;
1880
-      prepare_move_raw(); // this will also set_current_to_destination
1881
+      prepare_move_to_destination_raw(); // this will also set_current_to_destination
1881 1882
 
1882 1883
       stepper.synchronize();
1883 1884
 
@@ -1940,14 +1941,14 @@ static void setup_for_endstop_move() {
1940 1941
 
1941 1942
       #if Z_RAISE_AFTER_PROBING > 0
1942 1943
         destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
1943
-        prepare_move_raw(); // this will also set_current_to_destination
1944
+        prepare_move_to_destination_raw(); // this will also set_current_to_destination
1944 1945
       #endif
1945 1946
 
1946 1947
       // Move to the start position to initiate retraction
1947 1948
       destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_X;
1948 1949
       destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Y;
1949 1950
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Z;
1950
-      prepare_move_raw();
1951
+      prepare_move_to_destination_raw();
1951 1952
 
1952 1953
       // Move the nozzle down to push the Z probe into retracted position
1953 1954
       if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE)
@@ -1957,7 +1958,7 @@ static void setup_for_endstop_move() {
1957 1958
       if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y)
1958 1959
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y;
1959 1960
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z;
1960
-      prepare_move_raw();
1961
+      prepare_move_to_destination_raw();
1961 1962
 
1962 1963
       // Move up for safety
1963 1964
       if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE)
@@ -1967,13 +1968,13 @@ static void setup_for_endstop_move() {
1967 1968
       if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y)
1968 1969
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y;
1969 1970
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;
1970
-      prepare_move_raw();
1971
+      prepare_move_to_destination_raw();
1971 1972
 
1972 1973
       // Home XY for safety
1973 1974
       feedrate = homing_feedrate[X_AXIS] / 2;
1974 1975
       destination[X_AXIS] = 0;
1975 1976
       destination[Y_AXIS] = 0;
1976
-      prepare_move_raw(); // this will also set_current_to_destination
1977
+      prepare_move_to_destination_raw(); // this will also set_current_to_destination
1977 1978
 
1978 1979
       stepper.synchronize();
1979 1980
 
@@ -2468,7 +2469,7 @@ static void homeaxis(AxisEnum axis) {
2468 2469
       feedrate = retract_feedrate * 60;
2469 2470
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
2470 2471
       sync_plan_position_e();
2471
-      prepare_move();
2472
+      prepare_move_to_destination();
2472 2473
 
2473 2474
       if (retract_zlift > 0.01) {
2474 2475
         current_position[Z_AXIS] -= retract_zlift;
@@ -2477,7 +2478,7 @@ static void homeaxis(AxisEnum axis) {
2477 2478
         #else
2478 2479
           sync_plan_position();
2479 2480
         #endif
2480
-        prepare_move();
2481
+        prepare_move_to_destination();
2481 2482
       }
2482 2483
     }
2483 2484
     else {
@@ -2495,7 +2496,7 @@ static void homeaxis(AxisEnum axis) {
2495 2496
       float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
2496 2497
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
2497 2498
       sync_plan_position_e();
2498
-      prepare_move();
2499
+      prepare_move_to_destination();
2499 2500
     }
2500 2501
 
2501 2502
     feedrate = oldFeedrate;
@@ -2593,7 +2594,7 @@ inline void gcode_G0_G1() {
2593 2594
 
2594 2595
     #endif //FWRETRACT
2595 2596
 
2596
-    prepare_move();
2597
+    prepare_move_to_destination();
2597 2598
   }
2598 2599
 }
2599 2600
 
@@ -5887,7 +5888,7 @@ inline void gcode_M303() {
5887 5888
       calculate_SCARA_forward_Transform(delta);
5888 5889
       destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS];
5889 5890
       destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS];
5890
-      prepare_move();
5891
+      prepare_move_to_destination();
5891 5892
       //ok_to_send();
5892 5893
       return true;
5893 5894
     }
@@ -6716,7 +6717,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
6716 6717
       #endif
6717 6718
 
6718 6719
       // Move to the "old position" (move the extruder into place)
6719
-      if (IsRunning()) prepare_move();
6720
+      if (IsRunning()) prepare_move_to_destination();
6720 6721
 
6721 6722
     } // (tmp_extruder != active_extruder)
6722 6723
 
@@ -7597,32 +7598,9 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7597 7598
 }
7598 7599
 #endif  // MESH_BED_LEVELING
7599 7600
 
7600
-#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
7601
-
7602
-  inline void prevent_dangerous_extrude(float& curr_e, float& dest_e) {
7603
-    if (DEBUGGING(DRYRUN)) return;
7604
-    float de = dest_e - curr_e;
7605
-    if (de) {
7606
-      if (thermalManager.tooColdToExtrude(active_extruder)) {
7607
-        curr_e = dest_e; // Behave as if the move really took place, but ignore E part
7608
-        SERIAL_ECHO_START;
7609
-        SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
7610
-      }
7611
-      #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
7612
-        if (labs(de) > EXTRUDE_MAXLENGTH) {
7613
-          curr_e = dest_e; // Behave as if the move really took place, but ignore E part
7614
-          SERIAL_ECHO_START;
7615
-          SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
7616
-        }
7617
-      #endif
7618
-    }
7619
-  }
7620
-
7621
-#endif // PREVENT_DANGEROUS_EXTRUDE
7622
-
7623 7601
 #if ENABLED(DELTA) || ENABLED(SCARA)
7624 7602
 
7625
-  inline bool prepare_move_delta(float target[NUM_AXIS]) {
7603
+  inline bool prepare_delta_move_to(float target[NUM_AXIS]) {
7626 7604
     float difference[NUM_AXIS];
7627 7605
     for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = target[i] - current_position[i];
7628 7606
 
@@ -7651,8 +7629,8 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7651 7629
         if (!bed_leveling_in_progress) adjust_delta(target);
7652 7630
       #endif
7653 7631
 
7654
-      //DEBUG_POS("prepare_move_delta", target);
7655
-      //DEBUG_POS("prepare_move_delta", delta);
7632
+      //DEBUG_POS("prepare_delta_move_to", target);
7633
+      //DEBUG_POS("prepare_delta_move_to", delta);
7656 7634
 
7657 7635
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate, active_extruder);
7658 7636
     }
@@ -7662,7 +7640,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7662 7640
 #endif // DELTA || SCARA
7663 7641
 
7664 7642
 #if ENABLED(SCARA)
7665
-  inline bool prepare_move_scara(float target[NUM_AXIS]) { return prepare_move_delta(target); }
7643
+  inline bool prepare_scara_move_to(float target[NUM_AXIS]) { return prepare_delta_move_to(target); }
7666 7644
 #endif
7667 7645
 
7668 7646
 #if ENABLED(DUAL_X_CARRIAGE)
@@ -7706,7 +7684,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7706 7684
 
7707 7685
 #if DISABLED(DELTA) && DISABLED(SCARA)
7708 7686
 
7709
-  inline bool prepare_move_cartesian() {
7687
+  inline bool prepare_cartesian_move_to_destination() {
7710 7688
     // Do not use feedrate_multiplier for E or Z only moves
7711 7689
     if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
7712 7690
       line_to_destination();
@@ -7724,13 +7702,36 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7724 7702
 
7725 7703
 #endif // !DELTA && !SCARA
7726 7704
 
7705
+#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
7706
+
7707
+  inline void prevent_dangerous_extrude(float& curr_e, float& dest_e) {
7708
+    if (DEBUGGING(DRYRUN)) return;
7709
+    float de = dest_e - curr_e;
7710
+    if (de) {
7711
+      if (thermalManager.tooColdToExtrude(active_extruder)) {
7712
+        curr_e = dest_e; // Behave as if the move really took place, but ignore E part
7713
+        SERIAL_ECHO_START;
7714
+        SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
7715
+      }
7716
+      #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
7717
+        if (labs(de) > EXTRUDE_MAXLENGTH) {
7718
+          curr_e = dest_e; // Behave as if the move really took place, but ignore E part
7719
+          SERIAL_ECHO_START;
7720
+          SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
7721
+        }
7722
+      #endif
7723
+    }
7724
+  }
7725
+
7726
+#endif // PREVENT_DANGEROUS_EXTRUDE
7727
+
7727 7728
 /**
7728 7729
  * Prepare a single move and get ready for the next one
7729 7730
  *
7730 7731
  * (This may call planner.buffer_line several times to put
7731 7732
  *  smaller moves into the planner for DELTA or SCARA.)
7732 7733
  */
7733
-void prepare_move() {
7734
+void prepare_move_to_destination() {
7734 7735
   clamp_to_software_endstops(destination);
7735 7736
   refresh_cmd_timeout();
7736 7737
 
@@ -7739,14 +7740,14 @@ void prepare_move() {
7739 7740
   #endif
7740 7741
 
7741 7742
   #if ENABLED(SCARA)
7742
-    if (!prepare_move_scara(destination)) return;
7743
+    if (!prepare_scara_move_to(destination)) return;
7743 7744
   #elif ENABLED(DELTA)
7744
-    if (!prepare_move_delta(destination)) return;
7745
+    if (!prepare_delta_move_to(destination)) return;
7745 7746
   #else
7746 7747
     #if ENABLED(DUAL_X_CARRIAGE)
7747 7748
       if (!prepare_move_dual_x_carriage()) return;
7748 7749
     #endif
7749
-    if (!prepare_move_cartesian()) return;
7750
+    if (!prepare_cartesian_move_to_destination()) return;
7750 7751
   #endif
7751 7752
 
7752 7753
   set_current_to_destination();
@@ -8262,7 +8263,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
8262 8263
       // travel moves have been received so enact them
8263 8264
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
8264 8265
       set_destination_to_current();
8265
-      prepare_move();
8266
+      prepare_move_to_destination();
8266 8267
     }
8267 8268
   #endif
8268 8269
 

Loading…
Откажи
Сачувај