diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 245739da1..03b39de03 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -766,13 +766,12 @@ void Temperature::manage_heater() { if (filament_sensor) { meas_shift_index = filwidth_delay_index[0] - meas_delay_cm; if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed + meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); // Get the delayed info and add 100 to reconstitute to a percent of // the nominal filament diameter then square it to get an area - meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); - float vm = pow((measurement_delay[meas_shift_index] + 100.0) * 0.01, 2); - NOLESS(vm, 0.01); - volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm; + const float vmroot = measurement_delay[meas_shift_index] * 0.01 + 1.0; + volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vmroot <= 0.1 ? 0.01 : sq(vmroot); } #endif // FILAMENT_WIDTH_SENSOR