Browse Source

Option to disable all volumetric extrusion

pull/1/head
Scott Lahteine 7 years ago
parent
commit
933f76fda3
  1. 7
      Marlin/Configuration_adv.h
  2. 4
      Marlin/src/gcode/config/M200-M205.cpp
  3. 6
      Marlin/src/gcode/gcode.cpp
  4. 8
      Marlin/src/inc/SanityCheck.h
  5. 4
      Marlin/src/lcd/ultralcd.cpp
  6. 21
      Marlin/src/module/configuration_store.cpp
  7. 11
      Marlin/src/module/planner.cpp
  8. 17
      Marlin/src/module/planner.h

7
Marlin/Configuration_adv.h

@ -1364,6 +1364,12 @@
*/ */
#define EXTENDED_CAPABILITIES_REPORT #define EXTENDED_CAPABILITIES_REPORT
/**
* Disable all Volumetric extrusion options
*/
//#define NO_VOLUMETRICS
#if DISABLED(NO_VOLUMETRICS)
/** /**
* Volumetric extrusion default state * Volumetric extrusion default state
* Activate to make volumetric extrusion the default method, * Activate to make volumetric extrusion the default method,
@ -1372,6 +1378,7 @@
* M200 D0 to disable, M200 Dn to set a new diameter. * M200 D0 to disable, M200 Dn to set a new diameter.
*/ */
//#define VOLUMETRIC_DEFAULT_ON //#define VOLUMETRIC_DEFAULT_ON
#endif
/** /**
* Enable this option for a leaner build of Marlin that removes all * Enable this option for a leaner build of Marlin that removes all

4
Marlin/src/gcode/config/M200-M205.cpp

@ -24,6 +24,8 @@
#include "../../Marlin.h" #include "../../Marlin.h"
#include "../../module/planner.h" #include "../../module/planner.h"
#if DISABLED(NO_VOLUMETRICS)
/** /**
* M200: Set filament diameter and set E axis units to cubic units * M200: Set filament diameter and set E axis units to cubic units
* *
@ -44,6 +46,8 @@ void GcodeSuite::M200() {
planner.calculate_volumetric_multipliers(); planner.calculate_volumetric_multipliers();
} }
#endif // !NO_VOLUMETRICS
/** /**
* M201: Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) * M201: Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
* *

6
Marlin/src/gcode/gcode.cpp

@ -465,9 +465,9 @@ void GcodeSuite::process_parsed_command() {
#endif #endif
#endif #endif
case 200: // M200: Set filament diameter, E to cubic units #if DISABLED(NO_VOLUMETRICS)
M200(); case 200: M200(); break; // M200: Set filament diameter, E to cubic units
break; #endif
case 201: M201(); break; // M201: Set max acceleration for print moves (units/s^2) case 201: M201(); break; // M201: Set max acceleration for print moves (units/s^2)

8
Marlin/src/inc/SanityCheck.h

@ -894,15 +894,19 @@ static_assert(1 >= 0
*/ */
#if ENABLED(DISABLE_X) || ENABLED(DISABLE_Y) || ENABLED(DISABLE_Z) #if ENABLED(DISABLE_X) || ENABLED(DISABLE_Y) || ENABLED(DISABLE_Z)
#if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING) #if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING)
#error "DISABLE_[XYZ] not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING."
#endif #endif
#endif // DISABLE_[XYZ] #endif // DISABLE_[XYZ]
/** /**
* Filament Width Sensor * Filament Width Sensor
*/ */
#if ENABLED(FILAMENT_WIDTH_SENSOR) && !HAS_FILAMENT_WIDTH_SENSOR #if ENABLED(FILAMENT_WIDTH_SENSOR)
#if !HAS_FILAMENT_WIDTH_SENSOR
#error "FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined." #error "FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined."
#elif ENABLED(NO_VOLUMETRICS)
#error "FILAMENT_WIDTH_SENSOR requires NO_VOLUMETRICS to be disabled."
#endif
#endif #endif
/** /**

4
Marlin/src/lcd/ultralcd.cpp

@ -3636,6 +3636,8 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &planner.extruder_advance_k, 0, 999); MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &planner.extruder_advance_k, 0, 999);
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers); MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
if (parser.volumetric_enabled) { if (parser.volumetric_enabled) {
@ -3657,6 +3659,8 @@ void kill_screen(const char* lcd_msg) {
#endif // EXTRUDERS > 1 #endif // EXTRUDERS > 1
} }
#endif // !NO_VOLUMETRICS
END_MENU(); END_MENU();
} }

21
Marlin/src/module/configuration_store.cpp

@ -239,7 +239,9 @@ void MarlinSettings::postprocess() {
thermalManager.updatePID(); thermalManager.updatePID();
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
planner.calculate_volumetric_multipliers(); planner.calculate_volumetric_multipliers();
#endif
#if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE) #if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE)
// Software endstops depend on home_offset // Software endstops depend on home_offset
@ -538,6 +540,11 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(fwretract.swap_retract_recover_feedrate_mm_s); EEPROM_WRITE(fwretract.swap_retract_recover_feedrate_mm_s);
#endif #endif
//
// Volumetric & Filament Size
//
#if DISABLED(NO_VOLUMETRICS)
EEPROM_WRITE(parser.volumetric_enabled); EEPROM_WRITE(parser.volumetric_enabled);
// Save filament sizes // Save filament sizes
@ -546,6 +553,8 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy); EEPROM_WRITE(dummy);
} }
#endif
// Save TMC2130 or TMC2208 Configuration, and placeholder values // Save TMC2130 or TMC2208 Configuration, and placeholder values
uint16_t val; uint16_t val;
#if HAS_TRINAMIC #if HAS_TRINAMIC
@ -1028,13 +1037,17 @@ void MarlinSettings::postprocess() {
// //
// Volumetric & Filament Size // Volumetric & Filament Size
// //
#if DISABLED(NO_VOLUMETRICS)
EEPROM_READ(parser.volumetric_enabled); EEPROM_READ(parser.volumetric_enabled);
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) { for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
EEPROM_READ(dummy); EEPROM_READ(dummy);
if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy; if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
} }
#endif
// //
// TMC2130 Stepper Current // TMC2130 Stepper Current
// //
@ -1484,6 +1497,8 @@ void MarlinSettings::reset() {
fwretract.reset(); fwretract.reset();
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
parser.volumetric_enabled = parser.volumetric_enabled =
#if ENABLED(VOLUMETRIC_DEFAULT_ON) #if ENABLED(VOLUMETRIC_DEFAULT_ON)
true true
@ -1494,6 +1509,8 @@ void MarlinSettings::reset() {
for (uint8_t q = 0; q < COUNT(planner.filament_size); q++) for (uint8_t q = 0; q < COUNT(planner.filament_size); q++)
planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA; planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
#endif
endstops.enable_globally( endstops.enable_globally(
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT) #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
true true
@ -1630,6 +1647,8 @@ void MarlinSettings::reset() {
SERIAL_EOL(); SERIAL_EOL();
#if DISABLED(NO_VOLUMETRICS)
/** /**
* Volumetric extrusion M200 * Volumetric extrusion M200
*/ */
@ -1671,6 +1690,8 @@ void MarlinSettings::reset() {
SERIAL_ECHOLNPGM(" M200 D0"); SERIAL_ECHOLNPGM(" M200 D0");
} }
#endif // !NO_VOLUMETRICS
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Steps per unit:"); SERIAL_ECHOLNPGM("Steps per unit:");

11
Marlin/src/module/planner.cpp

@ -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 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 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
#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_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 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], uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
@ -561,6 +564,8 @@ void Planner::check_axes_activity() {
#endif #endif
} }
#if DISABLED(NO_VOLUMETRICS)
/** /**
* Get a volumetric multiplier from a filament diameter. * Get a volumetric multiplier from a filament diameter.
* This is the reciprocal of the circular cross-section area. * This is the reciprocal of the circular cross-section area.
@ -581,6 +586,8 @@ void Planner::calculate_volumetric_multipliers() {
} }
} }
#endif // !NO_VOLUMETRICS
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
/** /**
* Convert the ratio value given by the filament width sensor * Convert the ratio value given by the filament width sensor

17
Marlin/src/module/planner.h

@ -159,11 +159,14 @@ class Planner {
static int16_t flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder 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 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
#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_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 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 // May be auto-adjusted by a filament width sensor
#endif
static float max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second static float max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
axis_steps_per_mm[XYZE_N], axis_steps_per_mm[XYZE_N],
@ -277,7 +280,11 @@ class Planner {
static void refresh_positioning(); static void refresh_positioning();
FORCE_INLINE static void refresh_e_factor(const uint8_t e) { 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. // Manage fans, paste pressure, etc.
@ -297,6 +304,8 @@ class Planner {
void calculate_volumetric_for_width_sensor(const int8_t encoded_ratio); void calculate_volumetric_for_width_sensor(const int8_t encoded_ratio);
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) { FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
filament_size[e] = v; filament_size[e] = v;
// make sure all extruders have some sane value for the filament size // make sure all extruders have some sane value for the filament size
@ -304,6 +313,8 @@ class Planner {
if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA; if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
} }
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
/** /**

Loading…
Cancel
Save