Option to disable all volumetric extrusion
This commit is contained in:
@ -239,7 +239,9 @@ void MarlinSettings::postprocess() {
|
||||
thermalManager.updatePID();
|
||||
#endif
|
||||
|
||||
planner.calculate_volumetric_multipliers();
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
planner.calculate_volumetric_multipliers();
|
||||
#endif
|
||||
|
||||
#if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE)
|
||||
// Software endstops depend on home_offset
|
||||
@ -538,13 +540,20 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_WRITE(fwretract.swap_retract_recover_feedrate_mm_s);
|
||||
#endif
|
||||
|
||||
EEPROM_WRITE(parser.volumetric_enabled);
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
// Save filament sizes
|
||||
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
||||
if (q < COUNT(planner.filament_size)) dummy = planner.filament_size[q];
|
||||
EEPROM_WRITE(dummy);
|
||||
}
|
||||
EEPROM_WRITE(parser.volumetric_enabled);
|
||||
|
||||
// Save filament sizes
|
||||
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
||||
if (q < COUNT(planner.filament_size)) dummy = planner.filament_size[q];
|
||||
EEPROM_WRITE(dummy);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Save TMC2130 or TMC2208 Configuration, and placeholder values
|
||||
uint16_t val;
|
||||
@ -1028,12 +1037,16 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
// Volumetric & Filament Size
|
||||
//
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
EEPROM_READ(parser.volumetric_enabled);
|
||||
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
||||
EEPROM_READ(dummy);
|
||||
if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
|
||||
}
|
||||
EEPROM_READ(parser.volumetric_enabled);
|
||||
|
||||
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
||||
EEPROM_READ(dummy);
|
||||
if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// TMC2130 Stepper Current
|
||||
@ -1484,15 +1497,19 @@ void MarlinSettings::reset() {
|
||||
fwretract.reset();
|
||||
#endif
|
||||
|
||||
parser.volumetric_enabled =
|
||||
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++)
|
||||
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
parser.volumetric_enabled =
|
||||
#if ENABLED(VOLUMETRIC_DEFAULT_ON)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++)
|
||||
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
|
||||
#endif
|
||||
|
||||
endstops.enable_globally(
|
||||
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
|
||||
@ -1630,46 +1647,50 @@ void MarlinSettings::reset() {
|
||||
|
||||
SERIAL_EOL();
|
||||
|
||||
/**
|
||||
* Volumetric extrusion M200
|
||||
*/
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPGM("Filament settings:");
|
||||
if (parser.volumetric_enabled)
|
||||
SERIAL_EOL();
|
||||
else
|
||||
SERIAL_ECHOLNPGM(" Disabled");
|
||||
}
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 D", LINEAR_UNIT(planner.filament_size[0]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 1
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 2
|
||||
/**
|
||||
* Volumetric extrusion M200
|
||||
*/
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 3
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
|
||||
SERIAL_ECHOPGM("Filament settings:");
|
||||
if (parser.volumetric_enabled)
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 4
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
|
||||
SERIAL_EOL();
|
||||
#endif // EXTRUDERS > 4
|
||||
#endif // EXTRUDERS > 3
|
||||
#endif // EXTRUDERS > 2
|
||||
#endif // EXTRUDERS > 1
|
||||
else
|
||||
SERIAL_ECHOLNPGM(" Disabled");
|
||||
}
|
||||
|
||||
if (!parser.volumetric_enabled) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(" M200 D0");
|
||||
}
|
||||
SERIAL_ECHOPAIR(" M200 D", LINEAR_UNIT(planner.filament_size[0]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 1
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 2
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 3
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
|
||||
SERIAL_EOL();
|
||||
#if EXTRUDERS > 4
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
|
||||
SERIAL_EOL();
|
||||
#endif // EXTRUDERS > 4
|
||||
#endif // EXTRUDERS > 3
|
||||
#endif // EXTRUDERS > 2
|
||||
#endif // EXTRUDERS > 1
|
||||
|
||||
if (!parser.volumetric_enabled) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(" M200 D0");
|
||||
}
|
||||
|
||||
#endif // !NO_VOLUMETRICS
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
|
@ -105,10 +105,13 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
|
||||
|
||||
int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
|
||||
|
||||
float Planner::e_factor[EXTRUDERS], // The flow percentage and volumetric multiplier combine to scale E movement
|
||||
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_area_nominal = CIRCLE_AREA((DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5), // Nominal cross-sectional area
|
||||
Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
||||
float Planner::e_factor[EXTRUDERS]; // The flow percentage and volumetric multiplier combine to scale E movement
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
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_area_nominal = CIRCLE_AREA((DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5), // Nominal cross-sectional area
|
||||
Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
||||
#endif
|
||||
|
||||
uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
|
||||
Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
|
||||
@ -561,25 +564,29 @@ void Planner::check_axes_activity() {
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a volumetric multiplier from a filament diameter.
|
||||
* This is the reciprocal of the circular cross-section area.
|
||||
* Return 1.0 with volumetric off or a diameter of 0.0.
|
||||
*/
|
||||
inline float calculate_volumetric_multiplier(const float &diameter) {
|
||||
return (parser.volumetric_enabled && diameter) ? 1.0 / CIRCLE_AREA(diameter * 0.5) : 1.0;
|
||||
}
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
/**
|
||||
* Convert the filament sizes into volumetric multipliers.
|
||||
* The multiplier converts a given E value into a length.
|
||||
*/
|
||||
void Planner::calculate_volumetric_multipliers() {
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++) {
|
||||
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
|
||||
refresh_e_factor(i);
|
||||
/**
|
||||
* Get a volumetric multiplier from a filament diameter.
|
||||
* This is the reciprocal of the circular cross-section area.
|
||||
* Return 1.0 with volumetric off or a diameter of 0.0.
|
||||
*/
|
||||
inline float calculate_volumetric_multiplier(const float &diameter) {
|
||||
return (parser.volumetric_enabled && diameter) ? 1.0 / CIRCLE_AREA(diameter * 0.5) : 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the filament sizes into volumetric multipliers.
|
||||
* The multiplier converts a given E value into a length.
|
||||
*/
|
||||
void Planner::calculate_volumetric_multipliers() {
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++) {
|
||||
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
|
||||
refresh_e_factor(i);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !NO_VOLUMETRICS
|
||||
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
/**
|
||||
|
@ -159,11 +159,14 @@ class Planner {
|
||||
|
||||
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
|
||||
filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
|
||||
volumetric_area_nominal, // Nominal cross-sectional area
|
||||
volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
||||
// May be auto-adjusted by a filament width sensor
|
||||
static float e_factor[EXTRUDERS]; // The flow percentage and volumetric multiplier combine to scale E movement
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
static float filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
|
||||
volumetric_area_nominal, // Nominal cross-sectional area
|
||||
volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
|
||||
// May be auto-adjusted by a filament width sensor
|
||||
#endif
|
||||
|
||||
static float max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
|
||||
axis_steps_per_mm[XYZE_N],
|
||||
@ -277,7 +280,11 @@ class Planner {
|
||||
static void refresh_positioning();
|
||||
|
||||
FORCE_INLINE static void refresh_e_factor(const uint8_t e) {
|
||||
e_factor[e] = volumetric_multiplier[e] * flow_percentage[e] * 0.01;
|
||||
e_factor[e] = (flow_percentage[e] * 0.01
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
* volumetric_multiplier[e]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
// Manage fans, paste pressure, etc.
|
||||
@ -297,12 +304,16 @@ class Planner {
|
||||
void calculate_volumetric_for_width_sensor(const int8_t encoded_ratio);
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
|
||||
filament_size[e] = v;
|
||||
// make sure all extruders have some sane value for the filament size
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++)
|
||||
if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
}
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
|
||||
FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
|
||||
filament_size[e] = v;
|
||||
// make sure all extruders have some sane value for the filament size
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++)
|
||||
if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
|
||||
|
Reference in New Issue
Block a user