Add Planner::set_filament_size for 2.0.x parity

This commit is contained in:
Scott Lahteine 2017-11-30 16:49:04 -06:00
parent ace3e50898
commit 8f462b5717
2 changed files with 12 additions and 8 deletions

View File

@ -8714,12 +8714,8 @@ inline void gcode_M200() {
// setting any extruder filament size disables volumetric on the assumption that // setting any extruder filament size disables volumetric on the assumption that
// slicers either generate in extruder values as cubic mm or as as filament feeds // slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders // for all extruders
if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) ) { if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) )
planner.filament_size[target_extruder] = parser.value_linear_units(); planner.set_filament_size(target_extruder, parser.value_linear_units());
// make sure all extruders have some sane value for the filament size
for (uint8_t i = 0; i < COUNT(planner.filament_size); i++)
if (!planner.filament_size[i]) planner.filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
}
} }
planner.calculate_volumetric_multipliers(); planner.calculate_volumetric_multipliers();
} }

View File

@ -251,8 +251,6 @@ class Planner {
// Manage fans, paste pressure, etc. // Manage fans, paste pressure, etc.
static void check_axes_activity(); static void check_axes_activity();
static void calculate_volumetric_multipliers();
/** /**
* Number of moves currently in the planner * Number of moves currently in the planner
*/ */
@ -260,6 +258,16 @@ class Planner {
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); } static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
// Update multipliers based on new diameter measurements
static void calculate_volumetric_multipliers();
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 ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
/** /**