From 8f462b57176769975b8f3527bb371a555f7c992e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Nov 2017 16:49:04 -0600 Subject: [PATCH] Add Planner::set_filament_size for 2.0.x parity --- Marlin/Marlin_main.cpp | 8 ++------ Marlin/planner.h | 12 ++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 839d51e93..65abe7dcb 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8714,12 +8714,8 @@ inline void gcode_M200() { // 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 // for all extruders - if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) ) { - planner.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; - } + if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) ) + planner.set_filament_size(target_extruder, parser.value_linear_units()); } planner.calculate_volumetric_multipliers(); } diff --git a/Marlin/planner.h b/Marlin/planner.h index fb593f618..6203ad47c 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -251,8 +251,6 @@ class Planner { // Manage fans, paste pressure, etc. static void check_axes_activity(); - static void calculate_volumetric_multipliers(); - /** * 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)); } + // 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) /**