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

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

38
   w.color(x_axis)  .adjuster( 2, GET_TEXT_F(MSG_AMAX_X),  getAxisMaxAcceleration_mm_s2(X) );
38
   w.color(x_axis)  .adjuster( 2, GET_TEXT_F(MSG_AMAX_X),  getAxisMaxAcceleration_mm_s2(X) );
39
   w.color(y_axis)  .adjuster( 4, GET_TEXT_F(MSG_AMAX_Y),  getAxisMaxAcceleration_mm_s2(Y) );
39
   w.color(y_axis)  .adjuster( 4, GET_TEXT_F(MSG_AMAX_Y),  getAxisMaxAcceleration_mm_s2(Y) );
40
   w.color(z_axis)  .adjuster( 6, GET_TEXT_F(MSG_AMAX_Z),  getAxisMaxAcceleration_mm_s2(Z) );
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
     w.color(e_axis).adjuster( 8, GET_TEXT_F(MSG_AMAX_E), getAxisMaxAcceleration_mm_s2(E0) );
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
     w.heading(GET_TEXT_F(MSG_AMAX_E));
44
     w.heading(GET_TEXT_F(MSG_AMAX_E));
45
     w.color(e_axis).adjuster( 8, F(LCD_STR_E0), getAxisMaxAcceleration_mm_s2(E0) );
45
     w.color(e_axis).adjuster( 8, F(LCD_STR_E0), getAxisMaxAcceleration_mm_s2(E0) );
46
     w.color(e_axis).adjuster(10, F(LCD_STR_E1), getAxisMaxAcceleration_mm_s2(E1) );
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
     w.color(e_axis).adjuster(12, F(LCD_STR_E2), getAxisMaxAcceleration_mm_s2(E2) );
48
     w.color(e_axis).adjuster(12, F(LCD_STR_E2), getAxisMaxAcceleration_mm_s2(E2) );
49
     #endif
49
     #endif
50
-    #if EXTRUDERS > 3
50
+    #if DISTINCT_E > 3
51
     w.color(e_axis).adjuster(14, F(LCD_STR_E3), getAxisMaxAcceleration_mm_s2(E3) );
51
     w.color(e_axis).adjuster(14, F(LCD_STR_E3), getAxisMaxAcceleration_mm_s2(E3) );
52
     #endif
52
     #endif
53
   #endif
53
   #endif
65
     case  7: UI_INCREMENT(AxisMaxAcceleration_mm_s2, Z ); break;
65
     case  7: UI_INCREMENT(AxisMaxAcceleration_mm_s2, Z ); break;
66
     case  8: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E0); break;
66
     case  8: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E0); break;
67
     case  9: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E0); break;
67
     case  9: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E0); break;
68
-    #if EXTRUDERS > 1 && ENABLED(DISTINCT_E_FACTORS)
68
+    #if DISTINCT_E > 1
69
     case 10: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E1); break;
69
     case 10: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E1); break;
70
     case 11: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E1); break;
70
     case 11: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E1); break;
71
     #endif
71
     #endif
72
-    #if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
72
+    #if DISTINCT_E > 2
73
     case 12: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E2); break;
73
     case 12: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E2); break;
74
     case 13: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E2); break;
74
     case 13: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E2); break;
75
     #endif
75
     #endif
76
-    #if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
76
+    #if DISTINCT_E > 3
77
     case 14: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E3); break;
77
     case 14: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E3); break;
78
     case 15: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E3); break;
78
     case 15: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E3); break;
79
     #endif
79
     #endif

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

64
     case  5: UI_INCREMENT(AxisMaxFeedrate_mm_s, Y); break;
64
     case  5: UI_INCREMENT(AxisMaxFeedrate_mm_s, Y); break;
65
     case  6: UI_DECREMENT(AxisMaxFeedrate_mm_s, Z); break;
65
     case  6: UI_DECREMENT(AxisMaxFeedrate_mm_s, Z); break;
66
     case  7: UI_INCREMENT(AxisMaxFeedrate_mm_s, Z); break;
66
     case  7: UI_INCREMENT(AxisMaxFeedrate_mm_s, Z); break;
67
+    #if DISTINCT_E > 0
67
     case  8: UI_DECREMENT(AxisMaxFeedrate_mm_s, E0); break;
68
     case  8: UI_DECREMENT(AxisMaxFeedrate_mm_s, E0); break;
68
     case  9: UI_INCREMENT(AxisMaxFeedrate_mm_s, E0); break;
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
     case 10: UI_DECREMENT(AxisMaxFeedrate_mm_s, E1); break;
72
     case 10: UI_DECREMENT(AxisMaxFeedrate_mm_s, E1); break;
71
     case 11: UI_INCREMENT(AxisMaxFeedrate_mm_s, E1); break;
73
     case 11: UI_INCREMENT(AxisMaxFeedrate_mm_s, E1); break;
72
     #endif
74
     #endif
73
-    #if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
75
+    #if DISTINCT_E > 2
74
     case 12: UI_DECREMENT(AxisMaxFeedrate_mm_s, E2); break;
76
     case 12: UI_DECREMENT(AxisMaxFeedrate_mm_s, E2); break;
75
     case 13: UI_INCREMENT(AxisMaxFeedrate_mm_s, E2); break;
77
     case 13: UI_INCREMENT(AxisMaxFeedrate_mm_s, E2); break;
76
     #endif
78
     #endif
77
-    #if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
79
+    #if DISTINCT_E > 3
78
     case 14: UI_DECREMENT(AxisMaxFeedrate_mm_s, E3); break;
80
     case 14: UI_DECREMENT(AxisMaxFeedrate_mm_s, E3); break;
79
     case 15: UI_INCREMENT(AxisMaxFeedrate_mm_s, E3); break;
81
     case 15: UI_INCREMENT(AxisMaxFeedrate_mm_s, E3); break;
80
     #endif
82
     #endif

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

134
 
134
 
135
 #if HAS_JUNCTION_DEVIATION
135
 #if HAS_JUNCTION_DEVIATION
136
   float Planner::junction_deviation_mm;         // (mm) M205 J
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
   #endif
139
   #endif
141
 #endif
140
 #endif
142
 
141
 
2139
 
2138
 
2140
     #if ENABLED(LIN_ADVANCE)
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
       }
2178
       }
2180
     #endif
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
     // Limit acceleration per axis
2181
     // Limit acceleration per axis
2189
     if (block->step_event_count <= cutoff_long) {
2182
     if (block->step_event_count <= cutoff_long) {
2190
       LIMIT_ACCEL_LONG(A_AXIS, 0);
2183
       LIMIT_ACCEL_LONG(A_AXIS, 0);
2191
       LIMIT_ACCEL_LONG(B_AXIS, 0);
2184
       LIMIT_ACCEL_LONG(B_AXIS, 0);
2192
       LIMIT_ACCEL_LONG(C_AXIS, 0);
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
     else {
2188
     else {
2196
       LIMIT_ACCEL_FLOAT(A_AXIS, 0);
2189
       LIMIT_ACCEL_FLOAT(A_AXIS, 0);
2197
       LIMIT_ACCEL_FLOAT(B_AXIS, 0);
2190
       LIMIT_ACCEL_FLOAT(B_AXIS, 0);
2198
       LIMIT_ACCEL_FLOAT(C_AXIS, 0);
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
   block->acceleration_steps_per_s2 = accel;
2195
   block->acceleration_steps_per_s2 = accel;

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

315
 
315
 
316
     #if HAS_JUNCTION_DEVIATION
316
     #if HAS_JUNCTION_DEVIATION
317
       static float junction_deviation_mm;       // (mm) M205 J
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
       #endif
320
       #endif
322
     #endif
321
     #endif
323
 
322
 
842
       FORCE_INLINE static void recalculate_max_e_jerk() {
841
       FORCE_INLINE static void recalculate_max_e_jerk() {
843
         const float prop = junction_deviation_mm * SQRT(0.5) / (1.0f - SQRT(0.5));
842
         const float prop = junction_deviation_mm * SQRT(0.5) / (1.0f - SQRT(0.5));
844
         LOOP_L_N(i, EXTRUDERS)
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
     #endif
846
     #endif
848
 
847
 

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

58
 #define _TMC_UART_DEFINE(SWHW, IC, ST, AI) TMC_UART_##SWHW##_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)
58
 #define _TMC_UART_DEFINE(SWHW, IC, ST, AI) TMC_UART_##SWHW##_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)
59
 #define TMC_UART_DEFINE(SWHW, ST, AI) _TMC_UART_DEFINE(SWHW, ST##_DRIVER_TYPE, ST, AI##_AXIS)
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
   #define TMC_SPI_DEFINE_E(AI) TMC_SPI_DEFINE(E##AI, E##AI)
62
   #define TMC_SPI_DEFINE_E(AI) TMC_SPI_DEFINE(E##AI, E##AI)
63
   #define TMC_UART_DEFINE_E(SWHW, AI) TMC_UART_DEFINE(SWHW, E##AI, E##AI)
63
   #define TMC_UART_DEFINE_E(SWHW, AI) TMC_UART_DEFINE(SWHW, E##AI, E##AI)
64
 #else
64
 #else

Loading…
Cancel
Save