🎨 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

@ -197,7 +197,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
#endif
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
HOTEND_LOOP() info.target_temperature[e] = thermalManager.degTargetHotend(e);
#endif

View file

@ -23,7 +23,7 @@
#include "../gcode.h"
#include "../../module/planner.h"
#if EXTRUDERS
#if HAS_EXTRUDERS
/**
* M221: Set extrusion percentage (M221 T0 S95)

View file

@ -520,7 +520,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 100: M100(); break; // M100: Free Memory Report
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
#endif
@ -596,8 +596,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
case 81: M81(); break; // M81: Turn off Power, including Power Supply, if possible
#if HAS_EXTRUDERS
case 82: M82(); break; // M82: Set E axis normal mode (same as other axes)
case 83: M83(); break; // M83: Set E axis relative mode
#endif
case 18: case 84: M18_M84(); break; // M18/M84: Disable Steppers / Set Timeout
case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
@ -674,7 +676,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 220: M220(); break; // M220: Set Feedrate Percentage: S<percent> ("FR" on your LCD)
#if EXTRUDERS
#if HAS_EXTRUDERS
case 221: M221(); break; // M221: Set Flow Percentage
#endif

View file

@ -633,10 +633,13 @@ private:
#if ENABLED(PSU_CONTROL)
static void M80();
#endif
static void M81();
#if HAS_EXTRUDERS
static void M82();
static void M83();
#endif
static void M85();
static void M92();
@ -644,7 +647,7 @@ private:
static void M100();
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
static void M104();
static void M109();
#endif
@ -776,7 +779,7 @@ private:
static void M220();
#if EXTRUDERS
#if HAS_EXTRUDERS
static void M221();
#endif

View file

@ -28,7 +28,7 @@
#include "../../module/motion.h"
#include "../../module/planner.h"
#if EXTRUDERS
#if HAS_EXTRUDERS
#include "../../module/temperature.h"
#endif
@ -171,7 +171,7 @@ void GcodeSuite::M360() {
// Per-Extruder settings
//
config_line(PSTR("NumExtruder"), EXTRUDERS);
#if EXTRUDERS
#if HAS_EXTRUDERS
LOOP_L_N(e, EXTRUDERS) {
config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)));
config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);

View file

@ -28,7 +28,7 @@
#include "../../inc/MarlinConfigPre.h"
#if EXTRUDERS
#if HAS_EXTRUDERS
#include "../gcode.h"
#include "../../module/temperature.h"

View file

@ -20,6 +20,10 @@
*
*/
#include "../../inc/MarlinConfigPre.h"
#if HAS_EXTRUDERS
#include "../gcode.h"
/**
@ -31,3 +35,5 @@ void GcodeSuite::M82() { set_e_absolute(); }
* M83: Set E codes relative while in Absolute Coordinates (G90) mode
*/
void GcodeSuite::M83() { set_e_relative(); }
#endif // HAS_EXTRUDERS

View file

@ -538,7 +538,12 @@
* E_MANUAL - Number of E steppers for LCD move options
*/
#if EXTRUDERS == 0
#if EXTRUDERS
#define HAS_EXTRUDERS 1
#if EXTRUDERS > 1
#define HAS_MULTI_EXTRUDER 1
#endif
#else
#undef EXTRUDERS
#define EXTRUDERS 0
#undef SINGLENOZZLE
@ -546,8 +551,6 @@
#undef SWITCHING_NOZZLE
#undef MIXING_EXTRUDER
#undef HOTEND_IDLE_TIMEOUT
#elif EXTRUDERS > 1
#define HAS_MULTI_EXTRUDER 1
#endif
#if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS
@ -663,7 +666,7 @@
* All the logical axes that can be commanded directly by G-code.
* Delta maps stepper-specific values to ABC steppers.
*/
#if EXTRUDERS
#if HAS_EXTRUDERS
#define LOGICAL_AXES INCREMENT(LINEAR_AXES)
#else
#define LOGICAL_AXES LINEAR_AXES

View file

@ -75,7 +75,7 @@
#define SERVO_DELAY { 50 }
#endif
#if EXTRUDERS == 0
#if !HAS_EXTRUDERS
#define NO_VOLUMETRICS
#undef TEMP_SENSOR_0
#undef TEMP_SENSOR_1

View file

@ -1555,7 +1555,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#if ENABLED(G26_MESH_VALIDATION)
#if !EXTRUDERS
#if !HAS_EXTRUDERS
#error "G26_MESH_VALIDATION requires at least one extruder."
#elif !HAS_MESH
#error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."

View file

@ -954,7 +954,7 @@ void MarlinUI::draw_status_screen() {
else
#endif
{
#if EXTRUDERS
#if HAS_EXTRUDERS
c = 'E';
per = planner.flow_percentage[0];
#endif

View file

@ -422,7 +422,7 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va
}
void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) {
#if EXTRUDERS
#if HAS_EXTRUDERS
uint16_t newvalue = swap16(*(uint16_t*)val_ptr);
uint8_t target_extruder;
switch (var.VP) {

View file

@ -100,7 +100,7 @@ void menu_info_thermistors() {
START_SCREEN();
#if EXTRUDERS
#if HAS_EXTRUDERS
#define THERMISTOR_ID TEMP_SENSOR_0
#include "../thermistornames.h"
STATIC_ITEM_P(PSTR(LCD_STR_E0 ": " THERMISTOR_NAME), SS_INVERT);
@ -171,7 +171,7 @@ void menu_info_thermistors() {
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT);
#endif
#if EXTRUDERS
#if HAS_EXTRUDERS
STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
#endif
@ -278,7 +278,7 @@ void menu_info() {
#else
SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer); // Printer Info >
SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board); // Board Info >
#if EXTRUDERS
#if HAS_EXTRUDERS
SUBMENU(MSG_INFO_THERMISTOR_MENU, menu_info_thermistors); // Thermistors >
#endif
#endif

View file

@ -195,7 +195,7 @@ void menu_tune() {
//
// Flow:
//
#if EXTRUDERS
#if HAS_EXTRUDERS
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
// Flow En:
#if HAS_MULTI_EXTRUDER

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);

View file

@ -144,7 +144,7 @@
#undef SPINDLE_DIR_PIN
#if HAS_CUTTER
#if !EXTRUDERS
#if !HAS_EXTRUDERS
#undef E0_DIR_PIN
#undef E0_ENABLE_PIN
#undef E0_STEP_PIN

View file

@ -353,7 +353,7 @@
#define _E6_PINS
#define _E7_PINS
#if EXTRUDERS
#if HAS_EXTRUDERS
#undef _E0_PINS
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3
#endif

View file

@ -49,10 +49,6 @@
#define HAS_GCODE_M876
#endif
#if EXTRUDERS
#define HAS_EXTRUDERS
#endif
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
#define HAS_SMART_EFF_MOD
#endif

View file

@ -198,7 +198,7 @@ MAGNETIC_PARKING_EXTRUDER = src_filter=+<src/gcode/probe/M951.cpp>
SDSUPPORT = src_filter=+<src/sd/cardreader.cpp> +<src/sd/Sd2Card.cpp> +<src/sd/SdBaseFile.cpp> +<src/sd/SdFatUtil.cpp> +<src/sd/SdFile.cpp> +<src/sd/SdVolume.cpp> +<src/gcode/sd>
HAS_MEDIA_SUBCALLS = src_filter=+<src/gcode/sd/M32.cpp>
GCODE_REPEAT_MARKERS = src_filter=+<src/feature/repeat.cpp> +<src/gcode/sd/M808.cpp>
HAS_EXTRUDERS = src_filter=+<src/gcode/temp/M104_M109.cpp> +<src/gcode/config/M221.cpp>
HAS_EXTRUDERS = src_filter=+<src/gcode/units/M82_M83.cpp> +<src/gcode/temp/M104_M109.cpp> +<src/gcode/config/M221.cpp>
HAS_COOLER = src_filter=+<src/feature/cooler.cpp> +<src/gcode/temp/M143_M193.cpp>
AUTO_REPORT_TEMPERATURES = src_filter=+<src/gcode/temp/M155.cpp>
INCH_MODE_SUPPORT = src_filter=+<src/gcode/units/G20_G21.cpp>

View file

@ -222,6 +222,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/gcode/temp/M104_M109.cpp>
-<src/gcode/temp/M155.cpp>
-<src/gcode/units/G20_G21.cpp>
-<src/gcode/units/M82_M83.cpp>
-<src/gcode/units/M149.cpp>
-<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
-<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>