Refuse a Filament Flow Ratio of 0 Instead of Writing NaN Extrusion (#16719)

A used filament with a flow ratio of 0 sliced in the GUI and wrote
E-92233720368547.758 on every extrusion move: GCode::_extrude multiplied
the flow by the ratio and divided by it again, giving 0 * 0 / 0 = NaN.
The CLI already rejected the value through the config check, but
Print::validate never looked at it.

Print::validate now stops the slice with an error naming the filament
when a used filament's flow ratio is 0 or nil, and _extrude converts the
flow to extrusion length with the bare filament cross-section, so the
ratio is applied once without a divide.
This commit is contained in:
HanifKoh authored and GitHub committed 2026-10-25 03:39:51 +08:00
1 parent 258ddc15e8
commit ca51cba597
4 files changed
+67 -4

No files matched your search

+3 -4
View File
@@ -9374,10 +9374,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
effective_height = static_cast<float>(m_sub_layer_height);
}
// Effective extrusion length per distance unit = (filament_flow_ratio/cross_section) * mm3_per_mm / print flow ratio
// m_writer.extruder()->e_per_mm3() below is (filament flow ratio / cross-sectional area)
double e_per_mm = m_writer.filament()->e_per_mm3() * _mm3_per_mm;
e_per_mm /= filament_flow_ratio;
// _mm3_per_mm already includes the filament flow ratio, so convert it with the bare cross-section
// rather than e_per_mm3(), which would apply the ratio a second time.
double e_per_mm = _mm3_per_mm / m_writer.filament()->filament_crossection();
// set speed
if (speed == -1) {