Browse Source

Move Stepper::synchronize to Planner (#10713)

Co-Authored-By: ejtagle <ejtagle@hotmail.com>
Scott Lahteine 6 years ago
parent
commit
306f0f2135
No account linked to committer's email address

+ 2
- 2
Marlin/src/Marlin.cpp View File

@@ -274,7 +274,7 @@ bool pin_is_protected(const pin_t pin) {
274 274
 
275 275
 void quickstop_stepper() {
276 276
   stepper.quick_stop();
277
-  stepper.synchronize();
277
+  planner.synchronize();
278 278
   set_current_from_steppers_for_axis(ALL_AXES);
279 279
   SYNC_PLAN_POSITION_KINEMATIC();
280 280
 }
@@ -461,7 +461,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
461 461
       planner.buffer_line_kinematic(current_position, MMM_TO_MMS(EXTRUDER_RUNOUT_SPEED), active_extruder);
462 462
       current_position[E_AXIS] = olde;
463 463
       planner.set_e_position_mm(olde);
464
-      stepper.synchronize();
464
+      planner.synchronize();
465 465
       #if ENABLED(SWITCHING_EXTRUDER)
466 466
         E0_ENABLE_WRITE(oldstatus);
467 467
       #else

+ 6
- 6
Marlin/src/feature/I2CPositionEncoder.cpp View File

@@ -356,11 +356,11 @@ bool I2CPositionEncoder::test_axis() {
356 356
   startCoord[encoderAxis] = startPosition;
357 357
   endCoord[encoderAxis] = endPosition;
358 358
 
359
-  stepper.synchronize();
359
+  planner.synchronize();
360 360
 
361 361
   planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
362 362
                       stepper.get_axis_position_mm(E_AXIS), feedrate, 0);
363
-  stepper.synchronize();
363
+  planner.synchronize();
364 364
 
365 365
   // if the module isn't currently trusted, wait until it is (or until it should be if things are working)
366 366
   if (!trusted) {
@@ -372,7 +372,7 @@ bool I2CPositionEncoder::test_axis() {
372 372
   if (trusted) { // if trusted, commence test
373 373
     planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
374 374
                         stepper.get_axis_position_mm(E_AXIS), feedrate, 0);
375
-    stepper.synchronize();
375
+    planner.synchronize();
376 376
   }
377 377
 
378 378
   return trusted;
@@ -415,12 +415,12 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
415 415
   startCoord[encoderAxis] = startDistance;
416 416
   endCoord[encoderAxis] = endDistance;
417 417
 
418
-  stepper.synchronize();
418
+  planner.synchronize();
419 419
 
420 420
   LOOP_L_N(i, iter) {
421 421
     planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
422 422
                         stepper.get_axis_position_mm(E_AXIS), feedrate, 0);
423
-    stepper.synchronize();
423
+    planner.synchronize();
424 424
 
425 425
     delay(250);
426 426
     startCount = get_position();
@@ -429,7 +429,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
429 429
 
430 430
     planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
431 431
                         stepper.get_axis_position_mm(E_AXIS), feedrate, 0);
432
-    stepper.synchronize();
432
+    planner.synchronize();
433 433
 
434 434
     //Read encoder distance
435 435
     delay(250);

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -797,7 +797,7 @@
797 797
 
798 798
       do_blocking_move_to(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
799 799
         //, min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) / 2.0);
800
-      stepper.synchronize();
800
+      planner.synchronize();
801 801
 
802 802
       SERIAL_PROTOCOLPGM("Place shim under nozzle");
803 803
       LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
@@ -806,7 +806,7 @@
806 806
 
807 807
       const float z1 = measure_point_with_encoder();
808 808
       do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
809
-      stepper.synchronize();
809
+      planner.synchronize();
810 810
 
811 811
       SERIAL_PROTOCOLPGM("Remove shim");
812 812
       LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);

+ 2
- 2
Marlin/src/feature/pause.cpp View File

@@ -122,7 +122,7 @@ static void do_pause_e_move(const float &length, const float &fr) {
122 122
   destination[E_AXIS] += length / planner.e_factor[active_extruder];
123 123
   planner.buffer_line_kinematic(destination, fr, active_extruder);
124 124
   set_current_from_destination();
125
-  stepper.synchronize();
125
+  planner.synchronize();
126 126
 }
127 127
 
128 128
 /**
@@ -370,7 +370,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
370 370
   COPY(resume_position, current_position);
371 371
 
372 372
   // Wait for buffered blocks to complete
373
-  stepper.synchronize();
373
+  planner.synchronize();
374 374
 
375 375
   // Initial retract before move to filament change position
376 376
   if (retract && thermalManager.hotEnoughToExtrude(active_extruder))

+ 1
- 1
Marlin/src/feature/runout.h View File

@@ -48,7 +48,7 @@ class FilamentRunoutSensor {
48 48
       if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
49 49
         filament_ran_out = true;
50 50
         enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
51
-        stepper.synchronize();
51
+        planner.synchronize();
52 52
       }
53 53
     }
54 54
   private:

+ 1
- 1
Marlin/src/feature/snmm.cpp View File

@@ -27,7 +27,7 @@
27 27
 #include "../module/stepper.h"
28 28
 
29 29
 void select_multiplexed_stepper(const uint8_t e) {
30
-  stepper.synchronize();
30
+  planner.synchronize();
31 31
   disable_e_steppers();
32 32
   WRITE(E_MUX0_PIN, TEST(e, 0) ? HIGH : LOW);
33 33
   WRITE(E_MUX1_PIN, TEST(e, 1) ? HIGH : LOW);

+ 1
- 1
Marlin/src/gcode/bedlevel/G26.cpp View File

@@ -500,7 +500,7 @@ inline bool prime_nozzle() {
500 500
         #endif
501 501
         G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0);
502 502
         set_destination_from_current();
503
-        stepper.synchronize();    // Without this synchronize, the purge is more consistent,
503
+        planner.synchronize();    // Without this synchronize, the purge is more consistent,
504 504
                                   // but because the planner has a buffer, we won't be able
505 505
                                   // to stop as quickly. So we put up with the less smooth
506 506
                                   // action to give the user a more responsive 'Stop'.

+ 2
- 2
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -391,7 +391,7 @@ void GcodeSuite::G29() {
391 391
       SERIAL_EOL();
392 392
     }
393 393
 
394
-    stepper.synchronize();
394
+    planner.synchronize();
395 395
 
396 396
     // Disable auto bed leveling during G29.
397 397
     // Be formal so G29 can be done successively without G28.
@@ -949,7 +949,7 @@ void GcodeSuite::G29() {
949 949
       #if ENABLED(DEBUG_LEVELING_FEATURE)
950 950
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
951 951
       #endif
952
-      stepper.synchronize();
952
+      planner.synchronize();
953 953
       enqueue_and_echo_commands_P(PSTR(Z_PROBE_END_SCRIPT));
954 954
     #endif
955 955
 

+ 2
- 2
Marlin/src/gcode/bedlevel/mbl/G29.cpp View File

@@ -132,7 +132,7 @@ void GcodeSuite::G29() {
132 132
         // One last "return to the bed" (as originally coded) at completion
133 133
         current_position[Z_AXIS] = MANUAL_PROBE_HEIGHT;
134 134
         line_to_current_position();
135
-        stepper.synchronize();
135
+        planner.synchronize();
136 136
 
137 137
         // After recording the last point, activate home and activate
138 138
         mbl_probe_index = -1;
@@ -147,7 +147,7 @@ void GcodeSuite::G29() {
147 147
           current_position[Z_AXIS] = 0;
148 148
           set_destination_from_current();
149 149
           buffer_line_to_destination(homing_feedrate(Z_AXIS));
150
-          stepper.synchronize();
150
+          planner.synchronize();
151 151
         #endif
152 152
 
153 153
         #if ENABLED(LCD_BED_LEVELING)

+ 1
- 1
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -171,7 +171,7 @@ void GcodeSuite::G28(const bool always_home_all) {
171 171
   #endif
172 172
 
173 173
   // Wait for planner moves to finish!
174
-  stepper.synchronize();
174
+  planner.synchronize();
175 175
 
176 176
   // Cancel the active G29 session
177 177
   #if ENABLED(PROBE_MANUALLY)

+ 1
- 1
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -85,7 +85,7 @@ void ac_setup(const bool reset_bed) {
85 85
     tool_change(0, 0, true);
86 86
   #endif
87 87
 
88
-  stepper.synchronize();
88
+  planner.synchronize();
89 89
   setup_for_endstop_or_probe_move();
90 90
 
91 91
   #if HAS_LEVELING

+ 1
- 1
Marlin/src/gcode/control/M17_M18_M84.cpp View File

@@ -50,7 +50,7 @@ void GcodeSuite::M18_M84() {
50 50
       stepper.finish_and_disable();
51 51
     }
52 52
     else {
53
-      stepper.synchronize();
53
+      planner.synchronize();
54 54
       if (parser.seen('X')) disable_X();
55 55
       if (parser.seen('Y')) disable_Y();
56 56
       if (parser.seen('Z')) disable_Z();

+ 1
- 1
Marlin/src/gcode/control/M226.cpp View File

@@ -37,7 +37,7 @@ void GcodeSuite::M226() {
37 37
 
38 38
       int target = LOW;
39 39
 
40
-      stepper.synchronize();
40
+      planner.synchronize();
41 41
 
42 42
       pinMode(pin, INPUT);
43 43
       switch (pin_state) {

+ 2
- 2
Marlin/src/gcode/control/M3-M5.cpp View File

@@ -79,7 +79,7 @@ inline void ocr_val_mode() {
79 79
 
80 80
 void GcodeSuite::M3_M4(bool is_M3) {
81 81
 
82
-  stepper.synchronize();   // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
82
+  planner.synchronize();   // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
83 83
   #if SPINDLE_DIR_CHANGE
84 84
     const bool rotation_dir = (is_M3 != SPINDLE_INVERT_DIR);
85 85
     if (SPINDLE_STOP_ON_DIR_CHANGE \
@@ -129,7 +129,7 @@ void GcodeSuite::M3_M4(bool is_M3) {
129 129
  * M5 turn off spindle
130 130
  */
131 131
 void GcodeSuite::M5() {
132
-  stepper.synchronize();
132
+  planner.synchronize();
133 133
   WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
134 134
   #if ENABLED(SPINDLE_LASER_PWM)
135 135
     analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0);

+ 1
- 1
Marlin/src/gcode/control/M400.cpp View File

@@ -28,6 +28,6 @@
28 28
  */
29 29
 void GcodeSuite::M400() {
30 30
 
31
-  stepper.synchronize();
31
+  planner.synchronize();
32 32
 
33 33
 }

+ 2
- 2
Marlin/src/gcode/control/M605.cpp View File

@@ -43,7 +43,7 @@
43 43
    *    Note: the X axis should be homed after changing dual x-carriage mode.
44 44
    */
45 45
   void GcodeSuite::M605() {
46
-    stepper.synchronize();
46
+    planner.synchronize();
47 47
     if (parser.seen('S')) dual_x_carriage_mode = (DualXMode)parser.value_byte();
48 48
     switch (dual_x_carriage_mode) {
49 49
       case DXC_FULL_CONTROL_MODE:
@@ -75,7 +75,7 @@
75 75
 #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
76 76
 
77 77
   void GcodeSuite::M605() {
78
-    stepper.synchronize();
78
+    planner.synchronize();
79 79
     extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE;
80 80
     SERIAL_ECHO_START();
81 81
     SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);

+ 1
- 1
Marlin/src/gcode/feature/advance/M900.cpp View File

@@ -37,7 +37,7 @@ void GcodeSuite::M900() {
37 37
   if (parser.seenval('K')) {
38 38
     const float newK = parser.floatval('K');
39 39
     if (WITHIN(newK, 0, 10)) {
40
-      stepper.synchronize();
40
+      planner.synchronize();
41 41
       planner.extruder_advance_K = newK;
42 42
     }
43 43
     else

+ 1
- 1
Marlin/src/gcode/geometry/G53-G59.cpp View File

@@ -33,7 +33,7 @@
33 33
  */
34 34
 bool GcodeSuite::select_coordinate_system(const int8_t _new) {
35 35
   if (active_coordinate_system == _new) return false;
36
-  stepper.synchronize();
36
+  planner.synchronize();
37 37
   float old_offset[XYZ] = { 0 }, new_offset[XYZ] = { 0 };
38 38
   if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
39 39
     COPY(old_offset, coordinate_system[active_coordinate_system]);

+ 2
- 2
Marlin/src/gcode/host/M114.cpp View File

@@ -77,7 +77,7 @@
77 77
       report_xyz(delta);
78 78
     #endif
79 79
 
80
-    stepper.synchronize();
80
+    planner.synchronize();
81 81
 
82 82
     SERIAL_PROTOCOLPGM("Stepper:");
83 83
     LOOP_XYZE(i) {
@@ -126,6 +126,6 @@ void GcodeSuite::M114() {
126 126
     }
127 127
   #endif
128 128
 
129
-  stepper.synchronize();
129
+  planner.synchronize();
130 130
   report_current_position();
131 131
 }

+ 1
- 1
Marlin/src/gcode/lcd/M0_M1.cpp View File

@@ -58,7 +58,7 @@ void GcodeSuite::M0_M1() {
58 58
 
59 59
   const bool has_message = !hasP && !hasS && args && *args;
60 60
 
61
-  stepper.synchronize();
61
+  planner.synchronize();
62 62
 
63 63
   #if ENABLED(ULTIPANEL)
64 64
 

+ 1
- 1
Marlin/src/gcode/motion/G0_G1.cpp View File

@@ -84,7 +84,7 @@ void GcodeSuite::G0_G1(
84 84
         #define _MOVE_SYNC parser.seenval('Z')  // Only for Z move
85 85
       #endif
86 86
       if (_MOVE_SYNC) {
87
-        stepper.synchronize();
87
+        planner.synchronize();
88 88
         SERIAL_ECHOLNPGM(MSG_Z_MOVE_COMP);
89 89
       }
90 90
     #endif

+ 1
- 1
Marlin/src/gcode/motion/G4.cpp View File

@@ -33,7 +33,7 @@ void GcodeSuite::G4() {
33 33
   if (parser.seenval('P')) dwell_ms = parser.value_millis(); // milliseconds to wait
34 34
   if (parser.seenval('S')) dwell_ms = parser.value_millis_from_seconds(); // seconds to wait
35 35
 
36
-  stepper.synchronize();
36
+  planner.synchronize();
37 37
   #if ENABLED(NANODLP_Z_SYNC)
38 38
     SERIAL_ECHOLNPGM(MSG_Z_MOVE_COMP);
39 39
   #endif

+ 4
- 4
Marlin/src/gcode/probe/G38.cpp View File

@@ -44,14 +44,14 @@ static bool G38_run_probe() {
44 44
     }
45 45
   #endif
46 46
 
47
-  stepper.synchronize();  // wait until the machine is idle
47
+  planner.synchronize();  // wait until the machine is idle
48 48
 
49 49
   // Move until destination reached or target hit
50 50
   endstops.enable(true);
51 51
   G38_move = true;
52 52
   G38_endstop_hit = false;
53 53
   prepare_move_to_destination();
54
-  stepper.synchronize();
54
+  planner.synchronize();
55 55
   G38_move = false;
56 56
 
57 57
   endstops.hit_on_purpose();
@@ -68,7 +68,7 @@ static bool G38_run_probe() {
68 68
       LOOP_XYZ(i) destination[i] += retract_mm[i];
69 69
       endstops.enable(false);
70 70
       prepare_move_to_destination();
71
-      stepper.synchronize();
71
+      planner.synchronize();
72 72
 
73 73
       feedrate_mm_s /= 4;
74 74
 
@@ -78,7 +78,7 @@ static bool G38_run_probe() {
78 78
       endstops.enable(true);
79 79
       G38_move = true;
80 80
       prepare_move_to_destination();
81
-      stepper.synchronize();
81
+      planner.synchronize();
82 82
       G38_move = false;
83 83
 
84 84
       set_current_from_steppers_for_axis(ALL_AXES);

+ 1
- 1
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp View File

@@ -179,7 +179,7 @@ void GcodeSuite::M30() {
179 179
  *
180 180
  */
181 181
 void GcodeSuite::M32() {
182
-  if (card.sdprinting) stepper.synchronize();
182
+  if (card.sdprinting) planner.synchronize();
183 183
 
184 184
   if (card.cardOK) {
185 185
     const bool call_procedure = parser.boolval('P');

+ 1
- 1
Marlin/src/lcd/ultralcd.cpp View File

@@ -570,7 +570,7 @@ uint16_t max_display_update_time = 0;
570 570
     no_reentry = true;
571 571
     const screenFunc_t old_screen = currentScreen;
572 572
     lcd_goto_screen(_lcd_synchronize);
573
-    stepper.synchronize(); // idle() is called until moves complete
573
+    planner.synchronize(); // idle() is called until moves complete
574 574
     no_reentry = false;
575 575
     lcd_goto_screen(old_screen);
576 576
   }

+ 2
- 2
Marlin/src/module/delta.cpp View File

@@ -32,7 +32,7 @@
32 32
 #include "motion.h"
33 33
 
34 34
 // For homing:
35
-#include "stepper.h"
35
+#include "planner.h"
36 36
 #include "endstops.h"
37 37
 #include "../lcd/ultralcd.h"
38 38
 #include "../Marlin.h"
@@ -258,7 +258,7 @@ bool home_delta() {
258 258
   current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (delta_height + 10);
259 259
   feedrate_mm_s = homing_feedrate(X_AXIS);
260 260
   line_to_current_position();
261
-  stepper.synchronize();
261
+  planner.synchronize();
262 262
 
263 263
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
264 264
   #if ENABLED(SENSORLESS_HOMING)

+ 3
- 3
Marlin/src/module/motion.cpp View File

@@ -402,7 +402,7 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
402 402
     if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< do_blocking_move_to");
403 403
   #endif
404 404
 
405
-  stepper.synchronize();
405
+  planner.synchronize();
406 406
 }
407 407
 void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) {
408 408
   do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
@@ -881,7 +881,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
881 881
               current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS],
882 882
               planner.max_feedrate_mm_s[X_AXIS], 1
883 883
             );
884
-            stepper.synchronize();
884
+            planner.synchronize();
885 885
             SYNC_PLAN_POSITION_KINEMATIC();
886 886
             extruder_duplication_enabled = true;
887 887
             active_extruder_parked = false;
@@ -1110,7 +1110,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
1110 1110
     planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s ? fr_mm_s : homing_feedrate(axis), active_extruder);
1111 1111
   #endif
1112 1112
 
1113
-  stepper.synchronize();
1113
+  planner.synchronize();
1114 1114
 
1115 1115
   if (is_home_dir) {
1116 1116
 

+ 5
- 0
Marlin/src/module/planner.cpp View File

@@ -1300,6 +1300,11 @@ void Planner::check_axes_activity() {
1300 1300
 #endif // PLANNER_LEVELING
1301 1301
 
1302 1302
 /**
1303
+ * Block until all buffered steps are executed / cleaned
1304
+ */
1305
+void Planner::synchronize() { while (has_blocks_queued() || stepper.cleaning_buffer_counter) idle(); }
1306
+
1307
+/**
1303 1308
  * Planner::_buffer_steps
1304 1309
  *
1305 1310
  * Add a new linear movement to the buffer (in terms of steps).

+ 5
- 0
Marlin/src/module/planner.h View File

@@ -551,6 +551,11 @@ class Planner {
551 551
      */
552 552
     FORCE_INLINE static bool has_blocks_queued() { return (block_buffer_head != block_buffer_tail); }
553 553
 
554
+    //
555
+    // Block until all buffered steps are executed
556
+    //
557
+    static void synchronize();
558
+
554 559
     /**
555 560
      * "Discard" the block and "release" the memory.
556 561
      * Called when the current block is no longer needed.

+ 1
- 7
Marlin/src/module/stepper.cpp View File

@@ -1977,12 +1977,6 @@ void Stepper::init() {
1977 1977
   set_directions(); // Init directions to last_direction_bits = 0
1978 1978
 }
1979 1979
 
1980
-
1981
-/**
1982
- * Block until all buffered steps are executed / cleaned
1983
- */
1984
-void Stepper::synchronize() { while (planner.has_blocks_queued() || cleaning_buffer_counter) idle(); }
1985
-
1986 1980
 /**
1987 1981
  * Set the stepper positions directly in steps
1988 1982
  *
@@ -2055,7 +2049,7 @@ float Stepper::get_axis_position_mm(const AxisEnum axis) {
2055 2049
 }
2056 2050
 
2057 2051
 void Stepper::finish_and_disable() {
2058
-  synchronize();
2052
+  planner.synchronize();
2059 2053
   disable_all_steppers();
2060 2054
 }
2061 2055
 

+ 3
- 8
Marlin/src/module/stepper.h View File

@@ -184,11 +184,6 @@ class Stepper {
184 184
     #endif
185 185
 
186 186
     //
187
-    // Block until all buffered steps are executed
188
-    //
189
-    static void synchronize();
190
-
191
-    //
192 187
     // Set the current position in steps
193 188
     //
194 189
     static void _set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
@@ -196,14 +191,14 @@ class Stepper {
196 191
     FORCE_INLINE static void _set_position(const AxisEnum a, const int32_t &v) { count_position[a] = v; }
197 192
 
198 193
     FORCE_INLINE static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
199
-      synchronize();
194
+      planner.synchronize();
200 195
       CRITICAL_SECTION_START;
201 196
       _set_position(a, b, c, e);
202 197
       CRITICAL_SECTION_END;
203 198
     }
204 199
 
205 200
     static void set_position(const AxisEnum a, const int32_t &v) {
206
-      synchronize();
201
+      planner.synchronize();
207 202
       CRITICAL_SECTION_START;
208 203
       count_position[a] = v;
209 204
       CRITICAL_SECTION_END;
@@ -212,7 +207,7 @@ class Stepper {
212 207
     FORCE_INLINE static void _set_e_position(const int32_t &e) { count_position[E_AXIS] = e; }
213 208
 
214 209
     static void set_e_position(const int32_t &e) {
215
-      synchronize();
210
+      planner.synchronize();
216 211
       CRITICAL_SECTION_START;
217 212
       count_position[E_AXIS] = e;
218 213
       CRITICAL_SECTION_END;

+ 10
- 11
Marlin/src/module/tool_change.cpp View File

@@ -24,7 +24,6 @@
24 24
 
25 25
 #include "motion.h"
26 26
 #include "planner.h"
27
-#include "stepper.h"
28 27
 
29 28
 #include "../Marlin.h"
30 29
 
@@ -71,7 +70,7 @@
71 70
   void move_extruder_servo(const uint8_t e) {
72 71
     constexpr int16_t angles[] = SWITCHING_EXTRUDER_SERVO_ANGLES;
73 72
     static_assert(COUNT(angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles.");
74
-    stepper.synchronize();
73
+    planner.synchronize();
75 74
     #if EXTRUDERS & 1
76 75
       if (e < EXTRUDERS - 1)
77 76
     #endif
@@ -87,7 +86,7 @@
87 86
 
88 87
   void move_nozzle_servo(const uint8_t e) {
89 88
     const int16_t angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES;
90
-    stepper.synchronize();
89
+    planner.synchronize();
91 90
     MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, angles[e]);
92 91
     safe_delay(500);
93 92
   }
@@ -144,7 +143,7 @@
144 143
         if (DEBUGGING(LEVELING)) DEBUG_POS("Moving to Raised Z-Position", current_position);
145 144
       #endif
146 145
       planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
147
-      stepper.synchronize();
146
+      planner.synchronize();
148 147
 
149 148
       // STEP 2
150 149
       current_position[X_AXIS] = parkingposx[active_extruder] + hotend_offset[X_AXIS][active_extruder];
@@ -153,7 +152,7 @@
153 152
         if (DEBUGGING(LEVELING)) DEBUG_POS("Moving ParkPos", current_position);
154 153
       #endif
155 154
       planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
156
-      stepper.synchronize();
155
+      planner.synchronize();
157 156
 
158 157
       // STEP 3
159 158
       #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -171,7 +170,7 @@
171 170
         if (DEBUGGING(LEVELING)) DEBUG_POS("Moving away from parked extruder", current_position);
172 171
       #endif
173 172
       planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
174
-      stepper.synchronize();
173
+      planner.synchronize();
175 174
 
176 175
       // STEP 5
177 176
       #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -192,7 +191,7 @@
192 191
         if (DEBUGGING(LEVELING)) DEBUG_POS("Move UnparkPos", current_position);
193 192
       #endif
194 193
       planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS]/2, active_extruder);
195
-      stepper.synchronize();
194
+      planner.synchronize();
196 195
 
197 196
       // Step 7
198 197
       current_position[X_AXIS] = midpos - hotend_offset[X_AXIS][tmp_extruder];
@@ -201,7 +200,7 @@
201 200
         if (DEBUGGING(LEVELING)) DEBUG_POS("Move midway to new extruder", current_position);
202 201
       #endif
203 202
       planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
204
-      stepper.synchronize();
203
+      planner.synchronize();
205 204
       #if ENABLED(DEBUG_LEVELING_FEATURE)
206 205
         SERIAL_ECHOLNPGM("Autopark done.");
207 206
       #endif
@@ -283,7 +282,7 @@ inline void invalid_extruder_error(const uint8_t e) {
283 282
           planner.max_feedrate_mm_s[i == 1 ? X_AXIS : Z_AXIS],
284 283
           active_extruder
285 284
         );
286
-      stepper.synchronize();
285
+      planner.synchronize();
287 286
     }
288 287
 
289 288
     // Apply Y & Z extruder offset (X offset is used as home pos with Dual X)
@@ -466,7 +465,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
466 465
         #endif
467 466
       } // (tmp_extruder != active_extruder)
468 467
 
469
-      stepper.synchronize();
468
+      planner.synchronize();
470 469
 
471 470
       #if ENABLED(EXT_SOLENOID) && !ENABLED(PARKING_EXTRUDER)
472 471
         disable_all_solenoids();
@@ -493,7 +492,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
493 492
     #endif // HOTENDS <= 1
494 493
 
495 494
     #if DO_SWITCH_EXTRUDER
496
-      stepper.synchronize();
495
+      planner.synchronize();
497 496
       move_extruder_servo(active_extruder);
498 497
     #endif
499 498
 

+ 2
- 1
Marlin/src/sd/cardreader.cpp View File

@@ -28,6 +28,7 @@
28 28
 
29 29
 #include "../Marlin.h"
30 30
 #include "../lcd/ultralcd.h"
31
+#include "../module/planner.h"
31 32
 #include "../module/stepper.h"
32 33
 #include "../module/printcounter.h"
33 34
 #include "../core/language.h"
@@ -962,7 +963,7 @@ uint16_t CardReader::get_num_Files() {
962 963
 }
963 964
 
964 965
 void CardReader::printingHasFinished() {
965
-  stepper.synchronize();
966
+  planner.synchronize();
966 967
   file.close();
967 968
   if (file_subcall_ctr > 0) { // Heading up to a parent file that called current as a procedure.
968 969
     file_subcall_ctr--;

Loading…
Cancel
Save