Selaa lähdekoodia

Save 28b PROGMEM in ultralcd.cpp (line_to_current)

Scott Lahteine 8 vuotta sitten
vanhempi
commit
2a41f0ff84
1 muutettua tiedostoa jossa 16 lisäystä ja 19 poistoa
  1. 16
    19
      Marlin/ultralcd.cpp

+ 16
- 19
Marlin/ultralcd.cpp Näytä tiedosto

@@ -686,8 +686,13 @@ void kill_screen(const char* lcd_msg) {
686 686
     else lcd_buzz(20, 440);
687 687
   }
688 688
 
689
-  inline void line_to_current(AxisEnum axis) {
690
-    planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[axis]), active_extruder);
689
+  inline void line_to_current_z() {
690
+    planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[Z_AXIS]), active_extruder);
691
+  }
692
+
693
+  inline void line_to_z(const float &z) {
694
+    current_position[Z_AXIS] = z;
695
+    line_to_current_z();
691 696
   }
692 697
 
693 698
   #if ENABLED(SDSUPPORT)
@@ -1521,8 +1526,7 @@ void kill_screen(const char* lcd_msg) {
1521 1526
     //
1522 1527
     void _lcd_after_probing() {
1523 1528
       #if MANUAL_PROBE_HEIGHT > 0
1524
-        current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
1525
-        line_to_current(Z_AXIS);
1529
+        line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT);
1526 1530
       #endif
1527 1531
       // Display "Done" screen and wait for moves to complete
1528 1532
       #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
@@ -1539,15 +1543,13 @@ void kill_screen(const char* lcd_msg) {
1539 1543
       // Utility to go to the next mesh point
1540 1544
       inline void _manual_probe_goto_xy(float x, float y) {
1541 1545
         #if MANUAL_PROBE_HEIGHT > 0
1542
-          current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
1543
-          line_to_current(Z_AXIS);
1546
+          line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT);
1544 1547
         #endif
1545 1548
         current_position[X_AXIS] = LOGICAL_X_POSITION(x);
1546 1549
         current_position[Y_AXIS] = LOGICAL_Y_POSITION(y);
1547 1550
         planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
1548 1551
         #if MANUAL_PROBE_HEIGHT > 0
1549
-          current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
1550
-          line_to_current(Z_AXIS);
1552
+          line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS));
1551 1553
         #endif
1552 1554
         lcd_synchronize();
1553 1555
       }
@@ -1629,10 +1631,8 @@ void kill_screen(const char* lcd_msg) {
1629 1631
       //
1630 1632
       if (encoderPosition) {
1631 1633
         refresh_cmd_timeout();
1632
-        current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
1633
-        NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5);
1634
-        NOMORE(current_position[Z_AXIS],  (LCD_PROBE_Z_RANGE) * 0.5);
1635
-        line_to_current(Z_AXIS);
1634
+        const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP);
1635
+        line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5));
1636 1636
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
1637 1637
         encoderPosition = 0;
1638 1638
       }
@@ -2299,15 +2299,13 @@ void kill_screen(const char* lcd_msg) {
2299 2299
         reset_bed_level(); // After calibration bed-level data is no longer valid
2300 2300
       #endif
2301 2301
 
2302
-      current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5;
2303
-      line_to_current(Z_AXIS);
2302
+      line_to_z(max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2304 2303
 
2305 2304
       current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : cos(RADIANS(a)) * delta_calibration_radius;
2306 2305
       current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : sin(RADIANS(a)) * delta_calibration_radius;
2307
-      line_to_current(Z_AXIS);
2306
+      line_to_current_z();
2308 2307
 
2309
-      current_position[Z_AXIS] = 4.0;
2310
-      line_to_current(Z_AXIS);
2308
+      line_to_z(4.0);
2311 2309
 
2312 2310
       lcd_synchronize();
2313 2311
 
@@ -2536,8 +2534,7 @@ void kill_screen(const char* lcd_msg) {
2536 2534
     #if ENABLED(DELTA)
2537 2535
       #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
2538 2536
       void lcd_lower_z_to_clip_height() {
2539
-        current_position[Z_AXIS] = delta_clip_start_height;
2540
-        line_to_current(Z_AXIS);
2537
+        line_to_z(delta_clip_start_height);
2541 2538
         lcd_synchronize();
2542 2539
       }
2543 2540
     #else

Loading…
Peruuta
Tallenna