Browse Source

Merge pull request #4005 from thinkyhead/rc_prepare_move_destination

Clarify names of prepare_move functions
Scott Lahteine 8 years ago
parent
commit
2f1bf8373b
2 changed files with 54 additions and 54 deletions
  1. 0
    1
      Marlin/Marlin.h
  2. 54
    53
      Marlin/Marlin_main.cpp

+ 0
- 1
Marlin/Marlin.h View File

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

+ 54
- 53
Marlin/Marlin_main.cpp View File

529
 
529
 
530
 void get_available_commands();
530
 void get_available_commands();
531
 void process_next_command();
531
 void process_next_command();
532
+void prepare_move_to_destination();
532
 
533
 
533
 #if ENABLED(ARC_SUPPORT)
534
 #if ENABLED(ARC_SUPPORT)
534
   void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
535
   void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
1568
     /**
1569
     /**
1569
      * Calculate delta, start a line, and set current_position to destination
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
       #if ENABLED(DEBUG_LEVELING_FEATURE)
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
       #endif
1575
       #endif
1575
       refresh_cmd_timeout();
1576
       refresh_cmd_timeout();
1576
       calculate_delta(destination);
1577
       calculate_delta(destination);
1674
       // move down slowly until you find the bed
1675
       // move down slowly until you find the bed
1675
       feedrate = homing_feedrate[Z_AXIS] / 4;
1676
       feedrate = homing_feedrate[Z_AXIS] / 4;
1676
       destination[Z_AXIS] = -10;
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
       stepper.synchronize();
1679
       stepper.synchronize();
1679
       endstops.hit_on_purpose(); // clear endstop hit flags
1680
       endstops.hit_on_purpose(); // clear endstop hit flags
1680
 
1681
 
1754
       destination[Z_AXIS] = z;
1755
       destination[Z_AXIS] = z;
1755
 
1756
 
1756
       if (x == current_position[X_AXIS] && y == current_position[Y_AXIS])
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
       else
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
       stepper.synchronize();
1762
       stepper.synchronize();
1762
 
1763
 
1843
           destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X;
1844
           destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X;
1844
           destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y;
1845
           destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y;
1845
           destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Z;
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
           // Move to engage deployment
1849
           // Move to engage deployment
1849
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE)
1850
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE)
1854
             destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y;
1855
             destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y;
1855
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
1856
           if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
1856
             destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z;
1857
             destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z;
1857
-          prepare_move_raw();
1858
+          prepare_move_to_destination_raw();
1858
 
1859
 
1859
           #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
1860
           #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
1860
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)
1861
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)
1870
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z)
1871
             if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z)
1871
               destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z;
1872
               destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z;
1872
 
1873
 
1873
-            prepare_move_raw();
1874
+            prepare_move_to_destination_raw();
1874
           #endif
1875
           #endif
1875
         }
1876
         }
1876
 
1877
 
1877
       // Partially Home X,Y for safety
1878
       // Partially Home X,Y for safety
1878
       destination[X_AXIS] = destination[X_AXIS] * 0.75;
1879
       destination[X_AXIS] = destination[X_AXIS] * 0.75;
1879
       destination[Y_AXIS] = destination[Y_AXIS] * 0.75;
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
       stepper.synchronize();
1883
       stepper.synchronize();
1883
 
1884
 
1940
 
1941
 
1941
       #if Z_RAISE_AFTER_PROBING > 0
1942
       #if Z_RAISE_AFTER_PROBING > 0
1942
         destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
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
       #endif
1945
       #endif
1945
 
1946
 
1946
       // Move to the start position to initiate retraction
1947
       // Move to the start position to initiate retraction
1947
       destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_X;
1948
       destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_X;
1948
       destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Y;
1949
       destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Y;
1949
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Z;
1950
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Z;
1950
-      prepare_move_raw();
1951
+      prepare_move_to_destination_raw();
1951
 
1952
 
1952
       // Move the nozzle down to push the Z probe into retracted position
1953
       // Move the nozzle down to push the Z probe into retracted position
1953
       if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE)
1954
       if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE)
1957
       if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y)
1958
       if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y)
1958
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y;
1959
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y;
1959
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z;
1960
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z;
1960
-      prepare_move_raw();
1961
+      prepare_move_to_destination_raw();
1961
 
1962
 
1962
       // Move up for safety
1963
       // Move up for safety
1963
       if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE)
1964
       if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE)
1967
       if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y)
1968
       if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y)
1968
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y;
1969
         destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y;
1969
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;
1970
       destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;
1970
-      prepare_move_raw();
1971
+      prepare_move_to_destination_raw();
1971
 
1972
 
1972
       // Home XY for safety
1973
       // Home XY for safety
1973
       feedrate = homing_feedrate[X_AXIS] / 2;
1974
       feedrate = homing_feedrate[X_AXIS] / 2;
1974
       destination[X_AXIS] = 0;
1975
       destination[X_AXIS] = 0;
1975
       destination[Y_AXIS] = 0;
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
       stepper.synchronize();
1979
       stepper.synchronize();
1979
 
1980
 
2468
       feedrate = retract_feedrate * 60;
2469
       feedrate = retract_feedrate * 60;
2469
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
2470
       current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
2470
       sync_plan_position_e();
2471
       sync_plan_position_e();
2471
-      prepare_move();
2472
+      prepare_move_to_destination();
2472
 
2473
 
2473
       if (retract_zlift > 0.01) {
2474
       if (retract_zlift > 0.01) {
2474
         current_position[Z_AXIS] -= retract_zlift;
2475
         current_position[Z_AXIS] -= retract_zlift;
2477
         #else
2478
         #else
2478
           sync_plan_position();
2479
           sync_plan_position();
2479
         #endif
2480
         #endif
2480
-        prepare_move();
2481
+        prepare_move_to_destination();
2481
       }
2482
       }
2482
     }
2483
     }
2483
     else {
2484
     else {
2495
       float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
2496
       float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
2496
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
2497
       current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
2497
       sync_plan_position_e();
2498
       sync_plan_position_e();
2498
-      prepare_move();
2499
+      prepare_move_to_destination();
2499
     }
2500
     }
2500
 
2501
 
2501
     feedrate = oldFeedrate;
2502
     feedrate = oldFeedrate;
2593
 
2594
 
2594
     #endif //FWRETRACT
2595
     #endif //FWRETRACT
2595
 
2596
 
2596
-    prepare_move();
2597
+    prepare_move_to_destination();
2597
   }
2598
   }
2598
 }
2599
 }
2599
 
2600
 
5887
       calculate_SCARA_forward_Transform(delta);
5888
       calculate_SCARA_forward_Transform(delta);
5888
       destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS];
5889
       destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS];
5889
       destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS];
5890
       destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS];
5890
-      prepare_move();
5891
+      prepare_move_to_destination();
5891
       //ok_to_send();
5892
       //ok_to_send();
5892
       return true;
5893
       return true;
5893
     }
5894
     }
6716
       #endif
6717
       #endif
6717
 
6718
 
6718
       // Move to the "old position" (move the extruder into place)
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
     } // (tmp_extruder != active_extruder)
6722
     } // (tmp_extruder != active_extruder)
6722
 
6723
 
7597
 }
7598
 }
7598
 #endif  // MESH_BED_LEVELING
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
 #if ENABLED(DELTA) || ENABLED(SCARA)
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
     float difference[NUM_AXIS];
7604
     float difference[NUM_AXIS];
7627
     for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = target[i] - current_position[i];
7605
     for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = target[i] - current_position[i];
7628
 
7606
 
7651
         if (!bed_leveling_in_progress) adjust_delta(target);
7629
         if (!bed_leveling_in_progress) adjust_delta(target);
7652
       #endif
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
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate, active_extruder);
7635
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate, active_extruder);
7658
     }
7636
     }
7662
 #endif // DELTA || SCARA
7640
 #endif // DELTA || SCARA
7663
 
7641
 
7664
 #if ENABLED(SCARA)
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
 #endif
7644
 #endif
7667
 
7645
 
7668
 #if ENABLED(DUAL_X_CARRIAGE)
7646
 #if ENABLED(DUAL_X_CARRIAGE)
7706
 
7684
 
7707
 #if DISABLED(DELTA) && DISABLED(SCARA)
7685
 #if DISABLED(DELTA) && DISABLED(SCARA)
7708
 
7686
 
7709
-  inline bool prepare_move_cartesian() {
7687
+  inline bool prepare_cartesian_move_to_destination() {
7710
     // Do not use feedrate_multiplier for E or Z only moves
7688
     // Do not use feedrate_multiplier for E or Z only moves
7711
     if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
7689
     if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
7712
       line_to_destination();
7690
       line_to_destination();
7724
 
7702
 
7725
 #endif // !DELTA && !SCARA
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
  * Prepare a single move and get ready for the next one
7729
  * Prepare a single move and get ready for the next one
7729
  *
7730
  *
7730
  * (This may call planner.buffer_line several times to put
7731
  * (This may call planner.buffer_line several times to put
7731
  *  smaller moves into the planner for DELTA or SCARA.)
7732
  *  smaller moves into the planner for DELTA or SCARA.)
7732
  */
7733
  */
7733
-void prepare_move() {
7734
+void prepare_move_to_destination() {
7734
   clamp_to_software_endstops(destination);
7735
   clamp_to_software_endstops(destination);
7735
   refresh_cmd_timeout();
7736
   refresh_cmd_timeout();
7736
 
7737
 
7739
   #endif
7740
   #endif
7740
 
7741
 
7741
   #if ENABLED(SCARA)
7742
   #if ENABLED(SCARA)
7742
-    if (!prepare_move_scara(destination)) return;
7743
+    if (!prepare_scara_move_to(destination)) return;
7743
   #elif ENABLED(DELTA)
7744
   #elif ENABLED(DELTA)
7744
-    if (!prepare_move_delta(destination)) return;
7745
+    if (!prepare_delta_move_to(destination)) return;
7745
   #else
7746
   #else
7746
     #if ENABLED(DUAL_X_CARRIAGE)
7747
     #if ENABLED(DUAL_X_CARRIAGE)
7747
       if (!prepare_move_dual_x_carriage()) return;
7748
       if (!prepare_move_dual_x_carriage()) return;
7748
     #endif
7749
     #endif
7749
-    if (!prepare_move_cartesian()) return;
7750
+    if (!prepare_cartesian_move_to_destination()) return;
7750
   #endif
7751
   #endif
7751
 
7752
 
7752
   set_current_to_destination();
7753
   set_current_to_destination();
8262
       // travel moves have been received so enact them
8263
       // travel moves have been received so enact them
8263
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
8264
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
8264
       set_destination_to_current();
8265
       set_destination_to_current();
8265
-      prepare_move();
8266
+      prepare_move_to_destination();
8266
     }
8267
     }
8267
   #endif
8268
   #endif
8268
 
8269
 

Loading…
Cancel
Save