Browse Source

Some distinct E helpers

Scott Lahteine 4 years ago
parent
commit
eeabe66fc4

+ 4
- 1
Marlin/src/inc/Conditionals_LCD.h View File

@@ -408,7 +408,6 @@
408 408
 #if EXTRUDERS == 0
409 409
   #undef EXTRUDERS
410 410
   #define EXTRUDERS 0
411
-  #undef DISTINCT_E_FACTORS
412 411
   #undef SINGLENOZZLE
413 412
   #undef SWITCHING_EXTRUDER
414 413
   #undef SWITCHING_NOZZLE
@@ -513,12 +512,16 @@
513 512
  * DISTINCT_E_FACTORS affects how some E factors are accessed
514 513
  */
515 514
 #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
515
+  #define DISTINCT_E E_STEPPERS
516 516
   #define XYZE_N (XYZ + E_STEPPERS)
517
+  #define E_INDEX_N(E) (E)
517 518
   #define E_AXIS_N(E) AxisEnum(E_AXIS + E)
518 519
   #define UNUSED_E(E) NOOP
519 520
 #else
520 521
   #undef DISTINCT_E_FACTORS
522
+  #define DISTINCT_E 1
521 523
   #define XYZE_N XYZE
524
+  #define E_INDEX_N(E) 0
522 525
   #define E_AXIS_N(E) E_AXIS
523 526
   #define UNUSED_E(E) UNUSED(E)
524 527
 #endif

+ 7
- 7
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.cpp View File

@@ -38,16 +38,16 @@ void MaxAccelerationScreen::onRedraw(draw_mode_t what) {
38 38
   w.color(x_axis)  .adjuster( 2, GET_TEXT_F(MSG_AMAX_X),  getAxisMaxAcceleration_mm_s2(X) );
39 39
   w.color(y_axis)  .adjuster( 4, GET_TEXT_F(MSG_AMAX_Y),  getAxisMaxAcceleration_mm_s2(Y) );
40 40
   w.color(z_axis)  .adjuster( 6, GET_TEXT_F(MSG_AMAX_Z),  getAxisMaxAcceleration_mm_s2(Z) );
41
-  #if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
41
+  #if DISTINCT_E == 1
42 42
     w.color(e_axis).adjuster( 8, GET_TEXT_F(MSG_AMAX_E), getAxisMaxAcceleration_mm_s2(E0) );
43
-  #elif EXTRUDERS > 1
43
+  #elif DISTINCT_E > 1
44 44
     w.heading(GET_TEXT_F(MSG_AMAX_E));
45 45
     w.color(e_axis).adjuster( 8, F(LCD_STR_E0), getAxisMaxAcceleration_mm_s2(E0) );
46 46
     w.color(e_axis).adjuster(10, F(LCD_STR_E1), getAxisMaxAcceleration_mm_s2(E1) );
47
-    #if EXTRUDERS > 2
47
+    #if DISTINCT_E > 2
48 48
     w.color(e_axis).adjuster(12, F(LCD_STR_E2), getAxisMaxAcceleration_mm_s2(E2) );
49 49
     #endif
50
-    #if EXTRUDERS > 3
50
+    #if DISTINCT_E > 3
51 51
     w.color(e_axis).adjuster(14, F(LCD_STR_E3), getAxisMaxAcceleration_mm_s2(E3) );
52 52
     #endif
53 53
   #endif
@@ -65,15 +65,15 @@ bool MaxAccelerationScreen::onTouchHeld(uint8_t tag) {
65 65
     case  7: UI_INCREMENT(AxisMaxAcceleration_mm_s2, Z ); break;
66 66
     case  8: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E0); break;
67 67
     case  9: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E0); break;
68
-    #if EXTRUDERS > 1 && ENABLED(DISTINCT_E_FACTORS)
68
+    #if DISTINCT_E > 1
69 69
     case 10: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E1); break;
70 70
     case 11: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E1); break;
71 71
     #endif
72
-    #if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
72
+    #if DISTINCT_E > 2
73 73
     case 12: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E2); break;
74 74
     case 13: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E2); break;
75 75
     #endif
76
-    #if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
76
+    #if DISTINCT_E > 3
77 77
     case 14: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E3); break;
78 78
     case 15: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E3); break;
79 79
     #endif

+ 5
- 3
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.cpp View File

@@ -64,17 +64,19 @@ bool MaxVelocityScreen::onTouchHeld(uint8_t tag) {
64 64
     case  5: UI_INCREMENT(AxisMaxFeedrate_mm_s, Y); break;
65 65
     case  6: UI_DECREMENT(AxisMaxFeedrate_mm_s, Z); break;
66 66
     case  7: UI_INCREMENT(AxisMaxFeedrate_mm_s, Z); break;
67
+    #if DISTINCT_E > 0
67 68
     case  8: UI_DECREMENT(AxisMaxFeedrate_mm_s, E0); break;
68 69
     case  9: UI_INCREMENT(AxisMaxFeedrate_mm_s, E0); break;
69
-    #if EXTRUDERS > 1 && ENABLED(DISTINCT_E_FACTORS)
70
+    #endif
71
+    #if DISTINCT_E > 1
70 72
     case 10: UI_DECREMENT(AxisMaxFeedrate_mm_s, E1); break;
71 73
     case 11: UI_INCREMENT(AxisMaxFeedrate_mm_s, E1); break;
72 74
     #endif
73
-    #if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
75
+    #if DISTINCT_E > 2
74 76
     case 12: UI_DECREMENT(AxisMaxFeedrate_mm_s, E2); break;
75 77
     case 13: UI_INCREMENT(AxisMaxFeedrate_mm_s, E2); break;
76 78
     #endif
77
-    #if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
79
+    #if DISTINCT_E > 3
78 80
     case 14: UI_DECREMENT(AxisMaxFeedrate_mm_s, E3); break;
79 81
     case 15: UI_INCREMENT(AxisMaxFeedrate_mm_s, E3); break;
80 82
     #endif

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

@@ -134,9 +134,8 @@ float Planner::steps_to_mm[XYZE_N];             // (mm) Millimeters per step
134 134
 
135 135
 #if HAS_JUNCTION_DEVIATION
136 136
   float Planner::junction_deviation_mm;         // (mm) M205 J
137
-  #if ENABLED(LIN_ADVANCE)
138
-    float Planner::max_e_jerk                   // Calculated from junction_deviation_mm
139
-      [TERN(DISTINCT_E_FACTORS, EXTRUDERS, 1)];
137
+  #if HAS_LINEAR_E_JERK
138
+    float Planner::max_e_jerk[DISTINCT_E];      // Calculated from junction_deviation_mm
140 139
   #endif
141 140
 #endif
142 141
 
@@ -2139,7 +2138,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2139 2138
 
2140 2139
     #if ENABLED(LIN_ADVANCE)
2141 2140
 
2142
-      #define MAX_E_JERK(N) TERN(HAS_JUNCTION_DEVIATION, max_e_jerk[E_AXIS_N(N)], max_jerk.e)
2141
+      #define MAX_E_JERK(N) TERN(HAS_LINEAR_E_JERK, max_e_jerk[E_INDEX_N(N)], max_jerk.e)
2143 2142
 
2144 2143
       /**
2145 2144
        *
@@ -2179,24 +2178,18 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2179 2178
       }
2180 2179
     #endif
2181 2180
 
2182
-    #if ENABLED(DISTINCT_E_FACTORS)
2183
-      #define ACCEL_IDX extruder
2184
-    #else
2185
-      #define ACCEL_IDX 0
2186
-    #endif
2187
-
2188 2181
     // Limit acceleration per axis
2189 2182
     if (block->step_event_count <= cutoff_long) {
2190 2183
       LIMIT_ACCEL_LONG(A_AXIS, 0);
2191 2184
       LIMIT_ACCEL_LONG(B_AXIS, 0);
2192 2185
       LIMIT_ACCEL_LONG(C_AXIS, 0);
2193
-      LIMIT_ACCEL_LONG(E_AXIS, ACCEL_IDX);
2186
+      LIMIT_ACCEL_LONG(E_AXIS, E_INDEX_N(extruder));
2194 2187
     }
2195 2188
     else {
2196 2189
       LIMIT_ACCEL_FLOAT(A_AXIS, 0);
2197 2190
       LIMIT_ACCEL_FLOAT(B_AXIS, 0);
2198 2191
       LIMIT_ACCEL_FLOAT(C_AXIS, 0);
2199
-      LIMIT_ACCEL_FLOAT(E_AXIS, ACCEL_IDX);
2192
+      LIMIT_ACCEL_FLOAT(E_AXIS, E_INDEX_N(extruder));
2200 2193
     }
2201 2194
   }
2202 2195
   block->acceleration_steps_per_s2 = accel;

+ 3
- 4
Marlin/src/module/planner.h View File

@@ -315,9 +315,8 @@ class Planner {
315 315
 
316 316
     #if HAS_JUNCTION_DEVIATION
317 317
       static float junction_deviation_mm;       // (mm) M205 J
318
-      #if ENABLED(LIN_ADVANCE)
319
-        static float max_e_jerk                 // Calculated from junction_deviation_mm
320
-          [TERN(DISTINCT_E_FACTORS, EXTRUDERS, 1)];
318
+      #if HAS_LINEAR_E_JERK
319
+        static float max_e_jerk[DISTINCT_E];    // Calculated from junction_deviation_mm
321 320
       #endif
322 321
     #endif
323 322
 
@@ -842,7 +841,7 @@ class Planner {
842 841
       FORCE_INLINE static void recalculate_max_e_jerk() {
843 842
         const float prop = junction_deviation_mm * SQRT(0.5) / (1.0f - SQRT(0.5));
844 843
         LOOP_L_N(i, EXTRUDERS)
845
-          max_e_jerk[E_AXIS_N(i)] = SQRT(prop * settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]);
844
+          max_e_jerk[E_INDEX_N(i)] = SQRT(prop * settings.max_acceleration_mm_per_s2[E_INDEX_N(i)]);
846 845
       }
847 846
     #endif
848 847
 

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

@@ -58,7 +58,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
58 58
 #define _TMC_UART_DEFINE(SWHW, IC, ST, AI) TMC_UART_##SWHW##_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)
59 59
 #define TMC_UART_DEFINE(SWHW, ST, AI) _TMC_UART_DEFINE(SWHW, ST##_DRIVER_TYPE, ST, AI##_AXIS)
60 60
 
61
-#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
61
+#if DISTINCT_E > 1
62 62
   #define TMC_SPI_DEFINE_E(AI) TMC_SPI_DEFINE(E##AI, E##AI)
63 63
   #define TMC_UART_DEFINE_E(SWHW, AI) TMC_UART_DEFINE(SWHW, E##AI, E##AI)
64 64
 #else

Loading…
Cancel
Save