From bf6a1816b44ecba09e17675ba928922a6fe42f01 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Nov 2017 06:27:00 -0600 Subject: [PATCH] Display volumetric ratio in terms of E mm --- Marlin/Marlin_main.cpp | 1 + Marlin/planner.cpp | 1 + Marlin/planner.h | 1 + Marlin/temperature.cpp | 5 +++-- Marlin/ultralcd_impl_DOGM.h | 5 +---- Marlin/ultralcd_impl_HD44780.h | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2951dc716..f340844dd 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -9689,6 +9689,7 @@ inline void gcode_M400() { stepper.synchronize(); } inline void gcode_M404() { if (parser.seen('W')) { filament_width_nominal = parser.value_linear_units(); + planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5); } else { SERIAL_PROTOCOLPGM("Filament dia (nominal mm):"); diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index e50770861..daaafa90c 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -95,6 +95,7 @@ int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extru 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 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N], diff --git a/Marlin/planner.h b/Marlin/planner.h index 17421b5bc..fb593f618 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -144,6 +144,7 @@ class Planner { 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 diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 1ab024d86..d6e8d80e1 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -814,8 +814,9 @@ void Temperature::manage_heater() { // Get the delayed info and add 100 to reconstitute to a percent of // the nominal filament diameter then square it to get an area - const float vmroot = measurement_delay[meas_shift_index] * 0.01 + 1.0; - planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vmroot <= 0.1 ? 0.01 : sq(vmroot); + float vmroot = measurement_delay[meas_shift_index] * 0.01 + 1.0; + NOLESS(vmroot, 0.1); + planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = 1.0 / CIRCLE_AREA(vmroot / 2); planner.refresh_e_factor(FILAMENT_SENSOR_EXTRUDER_NUM); } #endif // FILAMENT_WIDTH_SENSOR diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index d05fe9c68..57cf12dee 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -651,12 +651,9 @@ static void lcd_implementation_status_screen() { #if ENABLED(FILAMENT_LCD_DISPLAY) strcpy(wstring, ftostr12ns(filament_width_meas)); if (parser.volumetric_enabled) - strcpy(mstring, itostr3(100.0 * filament_width_meas / filament_width_nominal)); + strcpy(mstring, itostr3(100.0 * planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); else strcpy_P(mstring, PSTR("---")); - // Alternatively, show the ratio between cross-sectional areas: - //strcpy(mstring, itostr3(100.0 / CIRCLE_AREA(filament_width_nominal * 0.5) - // / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); #endif } diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index a4c6b18fb..760443edf 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -858,7 +858,7 @@ static void lcd_implementation_status_screen() { lcd.print(ftostr12ns(filament_width_meas)); lcd_printPGM(PSTR(" V")); if (parser.volumetric_enabled) { - lcd.print(itostr3(100.0 * filament_width_meas / filament_width_nominal)); + lcd.print(itostr3(100.0 * planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); lcd.write('%'); } else