🎨 Move HAS_EXTRUDERS

This commit is contained in:
Scott Lahteine
2021-05-21 08:23:09 -05:00
parent 8e28731f96
commit 87a943756a
25 changed files with 63 additions and 52 deletions

View File

@ -374,7 +374,7 @@ void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
planner.buffer_line(current_position, fr_mm_s, active_extruder);
}
#if EXTRUDERS
#if HAS_EXTRUDERS
void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s) {
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
current_position.e += length / planner.e_factor[active_extruder];
@ -421,7 +421,7 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
const uint16_t old_pct = feedrate_percentage;
feedrate_percentage = 100;
#if EXTRUDERS
#if HAS_EXTRUDERS
const float old_fac = planner.e_factor[active_extruder];
planner.e_factor[active_extruder] = 1.0f;
#endif
@ -433,7 +433,7 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
feedrate_mm_s = old_feedrate;
feedrate_percentage = old_pct;
#if EXTRUDERS
#if HAS_EXTRUDERS
planner.e_factor[active_extruder] = old_fac;
#endif
}

View File

@ -272,7 +272,7 @@ void sync_plan_position_e();
*/
void line_to_current_position(const_feedRate_t fr_mm_s=feedrate_mm_s);
#if EXTRUDERS
#if HAS_EXTRUDERS
void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s);
#endif

View File

@ -164,7 +164,7 @@ float Planner::steps_to_mm[DISTINCT_AXES]; // (mm) Millimeters per step
xyze_bool_t Planner::last_page_dir{0};
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
float Planner::e_factor[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0f); // The flow percentage and volumetric multiplier combine to scale E movement
#endif
@ -1836,7 +1836,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
db = target.b - position.b,
dc = target.c - position.c;
#if EXTRUDERS
#if HAS_EXTRUDERS
int32_t de = target.e - position.e;
#else
constexpr int32_t de = 0;
@ -1848,7 +1848,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
" A:", target.a, " (", da, " steps)"
" B:", target.b, " (", db, " steps)"
" C:", target.c, " (", dc, " steps)"
#if EXTRUDERS
#if HAS_EXTRUDERS
" E:", target.e, " (", de, " steps)"
#endif
);
@ -1921,7 +1921,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#endif
if (de < 0) SBI(dm, E_AXIS);
#if EXTRUDERS
#if HAS_EXTRUDERS
const float esteps_float = de * e_factor[extruder];
const uint32_t esteps = ABS(esteps_float) + 0.5f;
#else
@ -2003,7 +2003,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
steps_dist_mm.c = dc * steps_to_mm[C_AXIS];
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
#else
steps_dist_mm.e = 0.0f;
@ -2013,7 +2013,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) {
block->millimeters = (0
#if EXTRUDERS
#if HAS_EXTRUDERS
+ ABS(steps_dist_mm.e)
#endif
);
@ -2046,7 +2046,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(da, db, dc, dm, block));
}
#if EXTRUDERS
#if HAS_EXTRUDERS
block->steps.e = esteps;
#endif
@ -2107,7 +2107,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#endif
// Enable extruder(s)
#if EXTRUDERS
#if HAS_EXTRUDERS
if (esteps) {
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
@ -2209,7 +2209,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
}
// Limit speed on extruders, if any
#if EXTRUDERS
#if HAS_EXTRUDERS
{
current_speed.e = steps_dist_mm.e * inverse_secs;
#if HAS_MIXER_SYNC_CHANNEL

View File

@ -337,7 +337,7 @@ class Planner {
static xyze_bool_t last_page_dir; // Last page direction given
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
static int16_t flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
static float e_factor[EXTRUDERS]; // The flow percentage and volumetric multiplier combine to scale E movement
#endif
@ -494,7 +494,7 @@ class Planner {
static inline void set_max_jerk(const AxisEnum, const_float_t ) {}
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
FORCE_INLINE static void refresh_e_factor(const uint8_t e) {
e_factor[e] = flow_percentage[e] * 0.01f * TERN(NO_VOLUMETRICS, 1.0f, volumetric_multiplier[e]);
}

View File

@ -402,7 +402,7 @@ typedef struct SettingsDataStruct {
//
// ADVANCED_PAUSE_FEATURE
//
#if EXTRUDERS
#if HAS_EXTRUDERS
fil_change_settings_t fc_settings[EXTRUDERS]; // M603 T U L
#endif
@ -1321,7 +1321,7 @@ void MarlinSettings::postprocess() {
//
// Advanced Pause filament load & unload lengths
//
#if EXTRUDERS
#if HAS_EXTRUDERS
{
#if DISABLED(ADVANCED_PAUSE_FEATURE)
const fil_change_settings_t fc_settings[EXTRUDERS] = { 0, 0 };
@ -2235,7 +2235,7 @@ void MarlinSettings::postprocess() {
//
// Advanced Pause filament load & unload lengths
//
#if EXTRUDERS
#if HAS_EXTRUDERS
{
#if DISABLED(ADVANCED_PAUSE_FEATURE)
fil_change_settings_t fc_settings[EXTRUDERS];

View File

@ -822,7 +822,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
#endif // ELECTROMAGNETIC_SWITCHING_TOOLHEAD
#if EXTRUDERS
#if HAS_EXTRUDERS
inline void invalid_extruder_error(const uint8_t e) {
SERIAL_ECHO_START();
SERIAL_CHAR('T'); SERIAL_ECHO(e);