mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-03-17 16:25:36 -06:00
🎨 Conditional HAS_VOLUMETRIC_EXTRUSION
This commit is contained in:
parent
07630e6559
commit
90363cefd0
14 changed files with 41 additions and 41 deletions
|
|
@ -164,9 +164,8 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
|||
current_retract[active_extruder] = 0;
|
||||
|
||||
// Recover E, set_current_to_destination
|
||||
prepare_internal_move_to_destination(
|
||||
MUL_TERN(RETRACT_SYNC_MIXING, swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s, MIXING_STEPPERS)
|
||||
);
|
||||
const feedRate_t fr_mm_s = swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s;
|
||||
prepare_internal_move_to_destination(MUL_TERN(RETRACT_SYNC_MIXING, fr_mm_s, MIXING_STEPPERS));
|
||||
}
|
||||
|
||||
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
TERN_(HAS_WORKSPACE_OFFSET, info.workspace_offset = workspace_offset);
|
||||
E_TERN_(info.active_extruder = active_extruder);
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
info.flag.volumetric_enabled = parser.volumetric_enabled;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
COPY(info.filament_size, planner.filament_size);
|
||||
|
|
@ -496,7 +496,7 @@ void PrintJobRecovery::resume() {
|
|||
#endif
|
||||
|
||||
// Recover volumetric extrusion state
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
EXTRUDER_LOOP()
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("M200T"), e, F("D"), p_float_t(info.filament_size[e], 3)));
|
||||
|
|
@ -659,7 +659,7 @@ void PrintJobRecovery::resume() {
|
|||
DEBUG_ECHOLNPGM("active_extruder: ", info.active_extruder);
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
DEBUG_ECHOPGM("filament_size:");
|
||||
EXTRUDER_LOOP() DEBUG_ECHOLNPGM(" ", info.filament_size[e]);
|
||||
DEBUG_EOL();
|
||||
|
|
@ -725,7 +725,7 @@ void PrintJobRecovery::resume() {
|
|||
|
||||
DEBUG_ECHOLNPGM("flag.dryrun: ", AS_DIGIT(info.flag.dryrun));
|
||||
DEBUG_ECHOLNPGM("flag.allow_cold_extrusion: ", AS_DIGIT(info.flag.allow_cold_extrusion));
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
DEBUG_ECHOLNPGM("flag.volumetric_enabled: ", AS_DIGIT(info.flag.volumetric_enabled));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ typedef struct {
|
|||
uint8_t active_extruder;
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
float filament_size[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ typedef struct {
|
|||
#if HAS_LEVELING
|
||||
bool leveling:1; // M420 S
|
||||
#endif
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
bool volumetric_enabled:1; // M200 S D
|
||||
#endif
|
||||
} flag;
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ void GcodeSuite::G26() {
|
|||
|
||||
do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
bool volumetric_was_enabled = parser.volumetric_enabled;
|
||||
parser.volumetric_enabled = false;
|
||||
planner.calculate_volumetric_multipliers();
|
||||
|
|
@ -856,7 +856,7 @@ void GcodeSuite::G26() {
|
|||
destination.z = Z_CLEARANCE_BETWEEN_PROBES;
|
||||
move_to(destination, 0); // Raise the nozzle
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
parser.volumetric_enabled = volumetric_was_enabled;
|
||||
planner.calculate_volumetric_multipliers();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "../../MarlinCore.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
/**
|
||||
* M200: Set filament diameter and set E axis units to cubic units
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // !NO_VOLUMETRICS
|
||||
#endif // HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
/**
|
||||
* M201: Set max acceleration in units/s^2 for print moves.
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
case 200: M200(); break; // M200: Set filament diameter, E to cubic units
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ private:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
static void M200();
|
||||
static void M200_report(const bool forReplay=true);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ void GcodeSuite::M115() {
|
|||
cap_line(F("EEPROM"), ENABLED(EEPROM_SETTINGS));
|
||||
|
||||
// Volumetric Extrusion (M200)
|
||||
cap_line(F("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
|
||||
cap_line(F("VOLUMETRIC"), ENABLED(HAS_VOLUMETRIC_EXTRUSION));
|
||||
|
||||
// AUTOREPORT_POS (M154)
|
||||
cap_line(F("AUTOREPORT_POS"), ENABLED(AUTO_REPORT_POSITION));
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void GcodeSuite::M360() {
|
|||
#endif
|
||||
config_line_e(e, F("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
|
||||
config_line_e(e, F("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
|
||||
config_line_e(e, F("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
|
||||
config_line_e(e, F("Diameter"), TERN(HAS_VOLUMETRIC_EXTRUSION, planner.filament_size[e], DEFAULT_NOMINAL_FILAMENT_DIA));
|
||||
config_line_e(e, F("MaxTemp"), thermalManager.hotend_maxtemp[e]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -245,6 +245,10 @@
|
|||
#undef STEALTHCHOP_E
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#define HAS_VOLUMETRIC_EXTRUSION 1
|
||||
#endif
|
||||
|
||||
#if !TEMP_SENSOR_CHAMBER
|
||||
#undef CHAMBER_CHECK_INTERVAL
|
||||
#undef CHAMBER_AUTO_FAN_PIN
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include "../../module/planner.h"
|
||||
#include "../../module/stepper.h"
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
#include "../../gcode/parser.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ void menu_backlash();
|
|||
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#if ANY(HAS_VOLUMETRIC_EXTRUSION, ADVANCED_PAUSE_FEATURE)
|
||||
#define HAS_ADV_FILAMENT_MENU 1
|
||||
#endif
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ void menu_backlash();
|
|||
EDIT_ITEM(bool, MSG_NLE_ON, &stepper.ne.settings.enabled);
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
EDIT_ITEM(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
|
||||
|
||||
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
|
||||
|
|
@ -160,7 +160,7 @@ void menu_backlash();
|
|||
EDIT_ITEM_FAST_N(float43, e, MSG_FILAMENT_DIAM_E, &planner.filament_size[e], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
||||
#endif
|
||||
}
|
||||
#endif // !NO_VOLUMETRICS
|
||||
#endif // HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
|
||||
constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) D
|
|||
float Planner::e_factor[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0f); // The flow percentage and volumetric multiplier combine to scale E movement
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
float Planner::volumetric_area_nominal = CIRCLE_AREA(float(DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5f); // Nominal cross-sectional area
|
||||
float Planner::filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
|
||||
Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
||||
|
|
@ -1214,7 +1214,7 @@ void Planner::recalculate(const float safe_exit_speed_sqr) {
|
|||
if (fan_speed[f] > FAN_OFF_PWM) {
|
||||
const bool first_kick = fan_kick_end[f] == 0 && TERN1(FAN_KICKSTART_LINEAR, fan_speed[f] > set_fan_speed[f]);
|
||||
if (first_kick)
|
||||
fan_kick_end[f] = ms + (FAN_KICKSTART_TIME) TERN_(FAN_KICKSTART_LINEAR, * (fan_speed[f] - set_fan_speed[f]) / 255);
|
||||
fan_kick_end[f] = ms + MUL_TERN(FAN_KICKSTART_LINEAR, FAN_KICKSTART_TIME, (fan_speed[f] - set_fan_speed[f]) / 255);
|
||||
if (first_kick || PENDING(ms, fan_kick_end[f])) {
|
||||
fan_speed[f] = FAN_KICKSTART_POWER;
|
||||
return;
|
||||
|
|
@ -1360,7 +1360,7 @@ void Planner::check_axes_activity() {
|
|||
|
||||
#endif // AUTOTEMP
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
/**
|
||||
* Get a volumetric multiplier from a filament diameter.
|
||||
|
|
@ -1385,7 +1385,7 @@ void Planner::check_axes_activity() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // !NO_VOLUMETRICS
|
||||
#endif // HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
|
||||
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ class Planner {
|
|||
static float e_factor[EXTRUDERS]; // The flow percentage and volumetric multiplier combine to scale E movement
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
static float volumetric_area_nominal; // (mm^3) Nominal cross-sectional area
|
||||
static float filament_size[EXTRUDERS], // (mm) Diameter of filament, typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
|
||||
volumetric_multiplier[EXTRUDERS]; // (1/mm^2) Reciprocal of cross-sectional area of filament. Pre-calculated to reduce computation in the planner
|
||||
|
|
@ -660,7 +660,7 @@ class Planner {
|
|||
|
||||
#if HAS_EXTRUDERS
|
||||
FORCE_INLINE static void refresh_e_factor(const uint8_t e) {
|
||||
e_factor[e] = flow_percentage[e] * 0.01f IF_DISABLED(NO_VOLUMETRICS, * volumetric_multiplier[e]);
|
||||
e_factor[e] = MUL_TERN(HAS_VOLUMETRIC_EXTRUSION, flow_percentage[e] * 0.01f, volumetric_multiplier[e]);
|
||||
}
|
||||
|
||||
static void set_flow(const uint8_t e, const int16_t flow) {
|
||||
|
|
@ -702,7 +702,7 @@ class Planner {
|
|||
void enable_stall_prevention(const bool onoff);
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
// Update multipliers based on new diameter measurements
|
||||
static void calculate_volumetric_multipliers();
|
||||
|
|
@ -711,6 +711,10 @@ class Planner {
|
|||
// Update pre calculated extruder feedrate limits based on volumetric values
|
||||
static void calculate_volumetric_extruder_limit(const uint8_t e);
|
||||
static void calculate_volumetric_extruder_limits();
|
||||
FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const float v) {
|
||||
volumetric_extruder_limit[e] = v;
|
||||
calculate_volumetric_extruder_limit(e);
|
||||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static void set_filament_size(const uint8_t e, const float v) {
|
||||
|
|
@ -723,13 +727,6 @@ class Planner {
|
|||
|
||||
#endif
|
||||
|
||||
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
|
||||
FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const float v) {
|
||||
volumetric_extruder_limit[e] = v;
|
||||
calculate_volumetric_extruder_limit(e);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ typedef struct SettingsDataStruct {
|
|||
#endif
|
||||
|
||||
//
|
||||
// !NO_VOLUMETRIC
|
||||
// HAS_VOLUMETRIC_EXTRUSION
|
||||
//
|
||||
bool parser_volumetric_enabled; // M200 S parser.volumetric_enabled
|
||||
float planner_filament_size[EXTRUDERS]; // M200 T D planner.filament_size[]
|
||||
|
|
@ -733,7 +733,7 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
TERN_(PIDTEMP, thermalManager.updatePID());
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
planner.calculate_volumetric_multipliers();
|
||||
#elif EXTRUDERS
|
||||
for (uint8_t i = COUNT(planner.e_factor); i--;)
|
||||
|
|
@ -1399,7 +1399,7 @@ void MarlinSettings::postprocess() {
|
|||
{
|
||||
_FIELD_TEST(parser_volumetric_enabled);
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
|
||||
EEPROM_WRITE(parser.volumetric_enabled);
|
||||
EEPROM_WRITE(planner.filament_size);
|
||||
|
|
@ -2488,7 +2488,7 @@ void MarlinSettings::postprocess() {
|
|||
_FIELD_TEST(parser_volumetric_enabled);
|
||||
EEPROM_READ(storage);
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
if (!validating) {
|
||||
parser.volumetric_enabled = storage.volumetric_enabled;
|
||||
COPY(planner.filament_size, storage.filament_size);
|
||||
|
|
@ -3597,7 +3597,7 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
#if HAS_VOLUMETRIC_EXTRUSION
|
||||
parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON);
|
||||
for (uint8_t q = 0; q < COUNT(planner.filament_size); ++q)
|
||||
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
|
|
@ -3863,7 +3863,7 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// M200 Volumetric Extrusion
|
||||
//
|
||||
IF_DISABLED(NO_VOLUMETRICS, gcode.M200_report(forReplay));
|
||||
TERN_(HAS_VOLUMETRIC_EXTRUSION, gcode.M200_report(forReplay));
|
||||
|
||||
//
|
||||
// M92 Steps per Unit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue