Sfoglia il codice sorgente

Followup to stepper/planner refactor

Scott Lahteine 6 anni fa
parent
commit
435ecb6b67

+ 3
- 3
Marlin/src/module/planner.cpp Vedi File

@@ -962,7 +962,7 @@ void Planner::reverse_pass() {
962 962
 }
963 963
 
964 964
 // The kernel called by recalculate() when scanning the plan from first to last entry.
965
-void Planner::forward_pass_kernel(const block_t * const previous, block_t* const current, uint8_t block_index) {
965
+void Planner::forward_pass_kernel(const block_t* const previous, block_t* const current, const uint8_t block_index) {
966 966
   if (previous) {
967 967
     // If the previous block is an acceleration block, too short to complete the full speed
968 968
     // change, adjust the entry speed accordingly. Entry speeds have already been reset,
@@ -1586,7 +1586,7 @@ bool Planner::_buffer_steps(const int32_t (&target)[XYZE]
1586 1586
  * Returns true is movement is acceptable, false otherwise
1587 1587
  */
1588 1588
 bool Planner::_populate_block(block_t * const block, bool split_move,
1589
-    const int32_t (&target)[XYZE]
1589
+  const int32_t (&target)[XYZE]
1590 1590
   #if HAS_POSITION_FLOAT
1591 1591
     , const float (&target_float)[XYZE]
1592 1592
   #endif
@@ -2234,7 +2234,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2234 2234
         if (block->millimeters < 1.0) {
2235 2235
 
2236 2236
           // Fast acos approximation, minus the error bar to be safe
2237
-          float junction_theta = (RADIANS(-40) * sq(junction_cos_theta) - RADIANS(50)) * junction_cos_theta + RADIANS(90) - 0.18;
2237
+          const float junction_theta = (RADIANS(-40) * sq(junction_cos_theta) - RADIANS(50)) * junction_cos_theta + RADIANS(90) - 0.18;
2238 2238
 
2239 2239
           // If angle is greater than 135 degrees (octagon), find speed for approximate arc
2240 2240
           if (junction_theta > RADIANS(135)) {

+ 1
- 1
Marlin/src/module/planner.h Vedi File

@@ -452,7 +452,7 @@ class Planner {
452 452
      * - Wait for the number of spaces to open up in the planner
453 453
      * - Return the first head block
454 454
      */
455
-    FORCE_INLINE static block_t* get_next_free_block(uint8_t &next_buffer_head, uint8_t count = 1) {
455
+    FORCE_INLINE static block_t* get_next_free_block(uint8_t &next_buffer_head, const uint8_t count=1) {
456 456
 
457 457
       // Wait until there are enough slots free
458 458
       while (moves_free() < count) { idle(); }

+ 11
- 11
Marlin/src/module/stepper.cpp Vedi File

@@ -181,20 +181,20 @@ volatile int32_t Stepper::endstops_trigsteps[XYZ];
181 181
   #define LOCKED_X2_MOTOR locked_x2_motor
182 182
   #define LOCKED_Y2_MOTOR locked_y2_motor
183 183
   #define LOCKED_Z2_MOTOR locked_z2_motor
184
-  #define DUAL_ENDSTOP_APPLY_STEP(A,V)                                                                                                           \
185
-    if (performing_homing) {                                                                                                                        \
186
-      if (A##_HOME_DIR < 0) {                                                                                                                    \
184
+  #define DUAL_ENDSTOP_APPLY_STEP(A,V)                                                                                                      \
185
+    if (performing_homing) {                                                                                                                \
186
+      if (A##_HOME_DIR < 0) {                                                                                                               \
187 187
         if (!(TEST(endstops.current_endstop_bits, A##_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V);     \
188 188
         if (!(TEST(endstops.current_endstop_bits, A##2_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V);  \
189
-      }                                                                                                                                             \
190
-      else {                                                                                                                                        \
189
+      }                                                                                                                                     \
190
+      else {                                                                                                                                \
191 191
         if (!(TEST(endstops.current_endstop_bits, A##_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V);     \
192 192
         if (!(TEST(endstops.current_endstop_bits, A##2_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V);  \
193
-      }                                                                                                                                             \
194
-    }                                                                                                                                               \
195
-    else {                                                                                                                                          \
196
-      A##_STEP_WRITE(V);                                                                                                                         \
197
-      A##2_STEP_WRITE(V);                                                                                                                        \
193
+      }                                                                                                                                     \
194
+    }                                                                                                                                       \
195
+    else {                                                                                                                                  \
196
+      A##_STEP_WRITE(V);                                                                                                                    \
197
+      A##2_STEP_WRITE(V);                                                                                                                   \
198 198
     }
199 199
 #endif
200 200
 
@@ -2035,7 +2035,7 @@ int32_t Stepper::position(const AxisEnum axis) {
2035 2035
     if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
2036 2036
   #endif
2037 2037
 
2038
-  int32_t v = count_position[axis];
2038
+  const int32_t v = count_position[axis];
2039 2039
 
2040 2040
   #ifdef __AVR__
2041 2041
     // Reenable Stepper ISR

+ 5
- 5
Marlin/src/module/stepper.h Vedi File

@@ -98,8 +98,8 @@ class Stepper {
98 98
       static int32_t bezier_A,     // A coefficient in Bézier speed curve
99 99
                      bezier_B,     // B coefficient in Bézier speed curve
100 100
                      bezier_C;     // C coefficient in Bézier speed curve
101
-      static uint32_t bezier_F;    // F coefficient in Bézier speed curve
102
-      static uint32_t bezier_AV;   // AV coefficient in Bézier speed curve
101
+      static uint32_t bezier_F,    // F coefficient in Bézier speed curve
102
+                      bezier_AV;   // AV coefficient in Bézier speed curve
103 103
       #ifdef __AVR__
104 104
         static bool A_negative;    // If A coefficient was negative
105 105
       #endif
@@ -297,9 +297,9 @@ class Stepper {
297 297
         NOLESS(step_rate, uint32_t(F_CPU / 500000U));
298 298
         step_rate -= F_CPU / 500000; // Correct for minimal speed
299 299
         if (step_rate >= (8 * 256)) { // higher step rate
300
-          uint8_t tmp_step_rate = (step_rate & 0x00FF);
301
-          uint16_t table_address = (uint16_t)&speed_lookuptable_fast[(uint8_t)(step_rate >> 8)][0],
302
-                   gain = (uint16_t)pgm_read_word_near(table_address + 2);
300
+          const uint8_t tmp_step_rate = (step_rate & 0x00FF);
301
+          const uint16_t table_address = (uint16_t)&speed_lookuptable_fast[(uint8_t)(step_rate >> 8)][0],
302
+                         gain = (uint16_t)pgm_read_word_near(table_address + 2);
303 303
           timer = MultiU16X8toH16(tmp_step_rate, gain);
304 304
           timer = (uint16_t)pgm_read_word_near(table_address) - timer;
305 305
         }

Loading…
Annulla
Salva