ソースを参照

clear_block_buffer, kill_current_block in quick_stop

Scott Lahteine 6年前
コミット
36b97bde9f
3個のファイルの変更9行の追加6行の削除
  1. 3
    3
      Marlin/src/module/planner.cpp
  2. 3
    1
      Marlin/src/module/planner.h
  3. 3
    2
      Marlin/src/module/stepper.cpp

+ 3
- 3
Marlin/src/module/planner.cpp ファイルの表示

100
  * A ring buffer of moves described in steps
100
  * A ring buffer of moves described in steps
101
  */
101
  */
102
 block_t Planner::block_buffer[BLOCK_BUFFER_SIZE];
102
 block_t Planner::block_buffer[BLOCK_BUFFER_SIZE];
103
-volatile uint8_t Planner::block_buffer_head = 0,           // Index of the next block to be pushed
104
-                 Planner::block_buffer_tail = 0;
103
+volatile uint8_t Planner::block_buffer_head, // Index of the next block to be pushed
104
+                 Planner::block_buffer_tail;
105
 
105
 
106
 float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
106
 float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
107
       Planner::axis_steps_per_mm[XYZE_N],
107
       Planner::axis_steps_per_mm[XYZE_N],
207
 Planner::Planner() { init(); }
207
 Planner::Planner() { init(); }
208
 
208
 
209
 void Planner::init() {
209
 void Planner::init() {
210
-  block_buffer_head = block_buffer_tail = 0;
211
   ZERO(position);
210
   ZERO(position);
212
   #if HAS_POSITION_FLOAT
211
   #if HAS_POSITION_FLOAT
213
     ZERO(position_float);
212
     ZERO(position_float);
217
   #if ABL_PLANAR
216
   #if ABL_PLANAR
218
     bed_level_matrix.set_to_identity();
217
     bed_level_matrix.set_to_identity();
219
   #endif
218
   #endif
219
+  clear_block_buffer();
220
 }
220
 }
221
 
221
 
222
 #if ENABLED(BEZIER_JERK_CONTROL)
222
 #if ENABLED(BEZIER_JERK_CONTROL)

+ 3
- 1
Marlin/src/module/planner.h ファイルの表示

309
      */
309
      */
310
     FORCE_INLINE static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
310
     FORCE_INLINE static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
311
 
311
 
312
+    FORCE_INLINE static void clear_block_buffer() { block_buffer_head = block_buffer_tail = 0; }
313
+
312
     FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); }
314
     FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); }
313
 
315
 
314
     // Update multipliers based on new diameter measurements
316
     // Update multipliers based on new diameter measurements
594
         return bbru;
596
         return bbru;
595
       }
597
       }
596
 
598
 
597
-      static void clear_block_buffer_runtime(){
599
+      static void clear_block_buffer_runtime() {
598
         CRITICAL_SECTION_START
600
         CRITICAL_SECTION_START
599
           block_buffer_runtime_us = 0;
601
           block_buffer_runtime_us = 0;
600
         CRITICAL_SECTION_END
602
         CRITICAL_SECTION_END

+ 3
- 2
Marlin/src/module/stepper.cpp ファイルの表示

2083
 }
2083
 }
2084
 
2084
 
2085
 void Stepper::quick_stop() {
2085
 void Stepper::quick_stop() {
2086
-  cleaning_buffer_counter = 5000;
2087
   DISABLE_STEPPER_DRIVER_INTERRUPT();
2086
   DISABLE_STEPPER_DRIVER_INTERRUPT();
2088
-  while (planner.has_blocks_queued()) planner.discard_current_block();
2087
+  kill_current_block();
2089
   current_block = NULL;
2088
   current_block = NULL;
2089
+  cleaning_buffer_counter = 5000;
2090
+  planner.clear_block_buffer();
2090
   ENABLE_STEPPER_DRIVER_INTERRUPT();
2091
   ENABLE_STEPPER_DRIVER_INTERRUPT();
2091
   #if ENABLED(ULTRA_LCD)
2092
   #if ENABLED(ULTRA_LCD)
2092
     planner.clear_block_buffer_runtime();
2093
     planner.clear_block_buffer_runtime();

読み込み中…
キャンセル
保存