Quellcode durchsuchen

Merge pull request #9152 from thinkyhead/bf2_anti_stutter

[2.0.x] Ensure smooth printer movements
Scott Lahteine vor 7 Jahren
Ursprung
Commit
3ae41e5f7f
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 1
- 0
Marlin/src/HAL/HAL_AVR/HAL_AVR.h Datei anzeigen

139
 
139
 
140
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
140
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
141
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
141
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
142
+#define STEPPER_ISR_ENABLED() TEST(TIMSK1, OCIE1A)
142
 
143
 
143
 #define ENABLE_TEMPERATURE_INTERRUPT()  SBI(TIMSK0, OCIE0B)
144
 #define ENABLE_TEMPERATURE_INTERRUPT()  SBI(TIMSK0, OCIE0B)
144
 #define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0B)
145
 #define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0B)

+ 9
- 4
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp Datei anzeigen

112
 }
112
 }
113
 
113
 
114
 void HAL_timer_enable_interrupt(const uint8_t timer_num) {
114
 void HAL_timer_enable_interrupt(const uint8_t timer_num) {
115
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
115
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
116
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_IER = TC_IER_CPCS;
116
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_IER = TC_IER_CPCS;
117
 }
117
 }
118
 
118
 
119
 void HAL_timer_disable_interrupt(const uint8_t timer_num) {
119
 void HAL_timer_disable_interrupt(const uint8_t timer_num) {
120
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
120
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
121
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_IDR = TC_IDR_CPCS;
121
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_IDR = TC_IDR_CPCS;
122
 }
122
 }
123
 
123
 
124
+void HAL_timer_interrupt_enabled(const uint8_t timer_num) {
125
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
126
+  return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_IER == TC_IER_CPCS;
127
+}
128
+
124
 #if 0
129
 #if 0
125
   void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
130
   void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
126
-    const tTimerConfig *pConfig = &TimerConfig[timer_num];
131
+    const tTimerConfig * const pConfig = &TimerConfig[timer_num];
127
     TC_SetRC(pConfig->pTimerRegs, pConfig->channel, count);
132
     TC_SetRC(pConfig->pTimerRegs, pConfig->channel, count);
128
   }
133
   }
129
 
134
 
130
   void HAL_timer_isr_prologue(const uint8_t timer_num) {
135
   void HAL_timer_isr_prologue(const uint8_t timer_num) {
131
-    const tTimerConfig *pConfig = &TimerConfig[timer_num];
136
+    const tTimerConfig * const pConfig = &TimerConfig[timer_num];
132
     TC_GetStatus(pConfig->pTimerRegs, pConfig->channel);
137
     TC_GetStatus(pConfig->pTimerRegs, pConfig->channel);
133
   }
138
   }
134
 #endif
139
 #endif

+ 7
- 5
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h Datei anzeigen

55
 
55
 
56
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
56
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
57
 #define DISABLE_STEPPER_DRIVER_INTERRUPT()  HAL_timer_disable_interrupt(STEP_TIMER_NUM)
57
 #define DISABLE_STEPPER_DRIVER_INTERRUPT()  HAL_timer_disable_interrupt(STEP_TIMER_NUM)
58
+#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
58
 
59
 
59
 #define ENABLE_TEMPERATURE_INTERRUPT()  HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
60
 #define ENABLE_TEMPERATURE_INTERRUPT()  HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
60
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
61
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
91
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
92
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
92
 
93
 
93
 FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
94
 FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
94
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
95
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
95
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
96
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
96
 }
97
 }
97
 
98
 
98
 FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
99
 FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
99
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
100
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
100
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
101
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
101
 }
102
 }
102
 
103
 
103
 FORCE_INLINE static void HAL_timer_set_current_count(const uint8_t timer_num, const hal_timer_t count) {
104
 FORCE_INLINE static void HAL_timer_set_current_count(const uint8_t timer_num, const hal_timer_t count) {
104
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
105
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
105
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV = count;
106
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV = count;
106
 }
107
 }
107
 
108
 
108
 FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
109
 FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
109
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
110
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
110
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
111
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
111
 }
112
 }
112
 
113
 
113
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
114
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
114
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
115
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
116
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
115
 
117
 
116
 //void HAL_timer_isr_prologue(const uint8_t timer_num);
118
 //void HAL_timer_isr_prologue(const uint8_t timer_num);
117
 
119
 
118
 FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
120
 FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
119
-  const tTimerConfig *pConfig = &TimerConfig[timer_num];
121
+  const tTimerConfig * const pConfig = &TimerConfig[timer_num];
120
   // Reading the status register clears the interrupt flag
122
   // Reading the status register clears the interrupt flag
121
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;
123
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;
122
 }
124
 }

+ 8
- 0
Marlin/src/HAL/HAL_LPC1768/HAL_timers.cpp Datei anzeigen

75
   }
75
   }
76
 }
76
 }
77
 
77
 
78
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
79
+  switch (timer_num) {
80
+    case 0: return NVIC_GetActive(TIMER0_IRQn);
81
+    case 1: return NVIC_GetActive(TIMER1_IRQn);
82
+  }
83
+  return false;
84
+}
85
+
78
 void HAL_timer_isr_prologue(const uint8_t timer_num) {
86
 void HAL_timer_isr_prologue(const uint8_t timer_num) {
79
   switch (timer_num) {
87
   switch (timer_num) {
80
     case 0: SBI(LPC_TIM0->IR, 0); break; // Clear the Interrupt
88
     case 0: SBI(LPC_TIM0->IR, 0); break; // Clear the Interrupt

+ 3
- 0
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h Datei anzeigen

58
 
58
 
59
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
59
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
60
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
60
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
61
+#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
62
+
61
 #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
63
 #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
62
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
64
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
63
 
65
 
125
 
127
 
126
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
128
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
127
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
129
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
130
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
128
 void HAL_timer_isr_prologue(const uint8_t timer_num);
131
 void HAL_timer_isr_prologue(const uint8_t timer_num);
129
 
132
 
130
 #endif // _HAL_TIMERS_DUE_H
133
 #endif // _HAL_TIMERS_DUE_H

+ 11
- 3
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp Datei anzeigen

93
  * TODO: Calculate Timer prescale value, so we get the 32bit to adjust
93
  * TODO: Calculate Timer prescale value, so we get the 32bit to adjust
94
  */
94
  */
95
 
95
 
96
-void HAL_timer_start(uint8_t timer_num, uint32_t frequency) {
96
+void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
97
   nvic_irq_num irq_num;
97
   nvic_irq_num irq_num;
98
   switch (timer_num) {
98
   switch (timer_num) {
99
     case 1: irq_num = NVIC_TIMER1_CC; break;
99
     case 1: irq_num = NVIC_TIMER1_CC; break;
135
   }
135
   }
136
 }
136
 }
137
 
137
 
138
-void HAL_timer_enable_interrupt(uint8_t timer_num) {
138
+void HAL_timer_enable_interrupt(const uint8_t timer_num) {
139
   switch (timer_num) {
139
   switch (timer_num) {
140
     case STEP_TIMER_NUM:
140
     case STEP_TIMER_NUM:
141
       timer_enable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
141
       timer_enable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
148
   }
148
   }
149
 }
149
 }
150
 
150
 
151
-void HAL_timer_disable_interrupt(uint8_t timer_num) {
151
+void HAL_timer_disable_interrupt(const uint8_t timer_num) {
152
   switch (timer_num) {
152
   switch (timer_num) {
153
     case STEP_TIMER_NUM:
153
     case STEP_TIMER_NUM:
154
       timer_disable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
154
       timer_disable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
161
   }
161
   }
162
 }
162
 }
163
 
163
 
164
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
165
+  switch (timer_num) {
166
+    case STEP_TIMER_NUM: return bool(TIM_DIER(STEP_TIMER_DEV) & STEP_TIMER_CHAN);
167
+    case TEMP_TIMER_NUM: return bool(TIM_DIER(TEMP_TIMER_DEV) & TEMP_TIMER_CHAN);
168
+  }
169
+  return false;
170
+}
171
+
164
 #endif // __STM32F1__
172
 #endif // __STM32F1__

+ 5
- 5
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h Datei anzeigen

62
 #define STEP_TIMER_DEV TIMER_DEV(STEP_TIMER_NUM)
62
 #define STEP_TIMER_DEV TIMER_DEV(STEP_TIMER_NUM)
63
 #define TEMP_TIMER_DEV TIMER_DEV(TEMP_TIMER_NUM)
63
 #define TEMP_TIMER_DEV TIMER_DEV(TEMP_TIMER_NUM)
64
 
64
 
65
-
66
-
67
 //STM32_HAVE_TIMER(n);
65
 //STM32_HAVE_TIMER(n);
68
 
66
 
69
 #define HAL_TIMER_RATE         (F_CPU)  // frequency of timers peripherals
67
 #define HAL_TIMER_RATE         (F_CPU)  // frequency of timers peripherals
79
 
77
 
80
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() timer_enable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN)
78
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() timer_enable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN)
81
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() timer_disable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN)
79
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() timer_disable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN)
80
+#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
82
 
81
 
83
 #define ENABLE_TEMPERATURE_INTERRUPT() timer_enable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN)
82
 #define ENABLE_TEMPERATURE_INTERRUPT() timer_enable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN)
84
 #define DISABLE_TEMPERATURE_INTERRUPT() timer_disable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN)
83
 #define DISABLE_TEMPERATURE_INTERRUPT() timer_disable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN)
113
 // Public functions
112
 // Public functions
114
 // --------------------------------------------------------------------------
113
 // --------------------------------------------------------------------------
115
 
114
 
116
-void HAL_timer_start(uint8_t timer_num, uint32_t frequency);
117
-void HAL_timer_enable_interrupt(uint8_t timer_num);
118
-void HAL_timer_disable_interrupt(uint8_t timer_num);
115
+void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
116
+void HAL_timer_enable_interrupt(const uint8_t timer_num);
117
+void HAL_timer_disable_interrupt(const uint8_t timer_num);
118
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
119
 
119
 
120
 /**
120
 /**
121
  * NOTE: By default libmaple sets ARPE = 1, which means the Auto reload register is preloaded (will only update with an update event)
121
  * NOTE: By default libmaple sets ARPE = 1, which means the Auto reload register is preloaded (will only update with an update event)

+ 8
- 0
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp Datei anzeigen

67
   }
67
   }
68
 }
68
 }
69
 
69
 
70
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
71
+  switch (timer_num) {
72
+    case 0: return NVIC_IS_ENABLED(IRQ_FTM0);
73
+    case 1: return NVIC_IS_ENABLED(IRQ_FTM1);
74
+  }
75
+  return false;
76
+}
77
+
70
 void HAL_timer_isr_prologue(const uint8_t timer_num) {
78
 void HAL_timer_isr_prologue(const uint8_t timer_num) {
71
   switch(timer_num) {
79
   switch(timer_num) {
72
     case 0:
80
     case 0:

+ 3
- 1
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h Datei anzeigen

68
 
68
 
69
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
69
 #define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
70
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
70
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
71
+#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
72
+
71
 #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
73
 #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
72
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
74
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
73
 
75
 
110
 
112
 
111
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
113
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
112
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
114
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
115
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
113
 
116
 
114
 void HAL_timer_isr_prologue(const uint8_t timer_num);
117
 void HAL_timer_isr_prologue(const uint8_t timer_num);
115
 
118
 
116
 #endif // _HAL_TIMERS_TEENSY_H
119
 #endif // _HAL_TIMERS_TEENSY_H
117
-

+ 0
- 19
Marlin/src/core/serial.h Datei anzeigen

61
   };
61
   };
62
 #endif
62
 #endif
63
 
63
 
64
-//todo: HAL: breaks encapsulation
65
-// For AVR only, define a serial interface based on configuration
66
-#ifdef __AVR__
67
-  #ifdef USBCON
68
-    #include <HardwareSerial.h>
69
-    #if ENABLED(BLUETOOTH)
70
-      #define MYSERIAL0 bluetoothSerial
71
-    #else
72
-      #define MYSERIAL0 Serial
73
-    #endif // BLUETOOTH
74
-  #else
75
-    #include "../HAL/HAL_AVR/MarlinSerial.h"
76
-    #define MYSERIAL0 customizedSerial
77
-  #endif
78
-#elif defined(ARDUINO_ARCH_SAM)
79
-  // To pull the Serial port definitions and overrides
80
-  #include "../HAL/HAL_DUE/MarlinSerial_Due.h"
81
-#endif
82
-
83
 extern uint8_t marlin_debug_flags;
64
 extern uint8_t marlin_debug_flags;
84
 #define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
65
 #define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
85
 
66
 

+ 5
- 6
Marlin/src/module/planner.cpp Datei anzeigen

1352
 
1352
 
1353
   // Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED.
1353
   // Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED.
1354
   const float v_allowable = max_allowable_speed(-block->acceleration, MINIMUM_PLANNER_SPEED, block->millimeters);
1354
   const float v_allowable = max_allowable_speed(-block->acceleration, MINIMUM_PLANNER_SPEED, block->millimeters);
1355
-  block->entry_speed = min(vmax_junction, v_allowable);
1355
+  // If stepper ISR is disabled, this indicates buffer_segment wants to add a split block.
1356
+  // In this case start with the max. allowed speed to avoid an interrupted first move.
1357
+  block->entry_speed = STEPPER_ISR_ENABLED() ? MINIMUM_PLANNER_SPEED : min(vmax_junction, v_allowable);
1356
 
1358
 
1357
   // Initialize planner efficiency flags
1359
   // Initialize planner efficiency flags
1358
   // Set flag if block will always reach maximum junction speed regardless of entry/exit speeds.
1360
   // Set flag if block will always reach maximum junction speed regardless of entry/exit speeds.
1362
   // block nominal speed limits both the current and next maximum junction speeds. Hence, in both
1364
   // block nominal speed limits both the current and next maximum junction speeds. Hence, in both
1363
   // the reverse and forward planners, the corresponding block junction speed will always be at the
1365
   // the reverse and forward planners, the corresponding block junction speed will always be at the
1364
   // the maximum junction speed and may always be ignored for any speed reduction checks.
1366
   // the maximum junction speed and may always be ignored for any speed reduction checks.
1365
-  block->flag |= BLOCK_FLAG_RECALCULATE | (block->nominal_speed <= v_allowable ? BLOCK_FLAG_NOMINAL_LENGTH : 0);
1367
+  block->flag |= block->nominal_speed <= v_allowable ? BLOCK_FLAG_RECALCULATE | BLOCK_FLAG_NOMINAL_LENGTH : BLOCK_FLAG_RECALCULATE;
1366
 
1368
 
1367
   // Update previous path unit_vector and nominal speed
1369
   // Update previous path unit_vector and nominal speed
1368
   COPY(previous_speed, current_speed);
1370
   COPY(previous_speed, current_speed);
1382
      *                                      In that case, the retract and move will be executed together.
1384
      *                                      In that case, the retract and move will be executed together.
1383
      *                                      This leads to too many advance steps due to a huge e_acceleration.
1385
      *                                      This leads to too many advance steps due to a huge e_acceleration.
1384
      *                                      The math is good, but we must avoid retract moves with advance!
1386
      *                                      The math is good, but we must avoid retract moves with advance!
1385
-     * lin_dist_e > 0                     : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
1387
+     * lin_dist_e > 0                       : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
1386
      */
1388
      */
1387
     block->use_advance_lead =  esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS])
1389
     block->use_advance_lead =  esteps && (block->steps[X_AXIS] || block->steps[Y_AXIS])
1388
                             && extruder_advance_k
1390
                             && extruder_advance_k
1398
 
1400
 
1399
   #endif // LIN_ADVANCE
1401
   #endif // LIN_ADVANCE
1400
 
1402
 
1401
-  const float bnsr = 1.0 / block->nominal_speed;
1402
-  calculate_trapezoid_for_block(block, block->entry_speed * bnsr, safe_speed * bnsr);
1403
-
1404
   // Move buffer head
1403
   // Move buffer head
1405
   block_buffer_head = next_buffer_head;
1404
   block_buffer_head = next_buffer_head;
1406
 
1405
 

+ 10
- 0
Marlin/src/module/planner.h Datei anzeigen

534
     static block_t* get_current_block() {
534
     static block_t* get_current_block() {
535
       if (blocks_queued()) {
535
       if (blocks_queued()) {
536
         block_t * const block = &block_buffer[block_buffer_tail];
536
         block_t * const block = &block_buffer[block_buffer_tail];
537
+
538
+        // If the block has no trapezoid calculated, it's unsafe to execute.
539
+        if (movesplanned() > 1) {
540
+          const block_t * const next = &block_buffer[next_block_index(block_buffer_tail)];
541
+          if (TEST(block->flag, BLOCK_BIT_RECALCULATE) || TEST(next->flag, BLOCK_BIT_RECALCULATE))
542
+            return NULL;
543
+        }
544
+        else if (TEST(block->flag, BLOCK_BIT_RECALCULATE))
545
+          return NULL;
546
+
537
         #if ENABLED(ULTRA_LCD)
547
         #if ENABLED(ULTRA_LCD)
538
           block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
548
           block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
539
         #endif
549
         #endif

Laden…
Abbrechen
Speichern