From 38425110685eff9361ce46f1ea307c20e2b39de2 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 9 Mar 2026 13:35:56 +0100 Subject: [PATCH] fix: round flush_volumes_matrix values to integers (#12672) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When flush_multiplier is applied to flush_volumes_matrix values, the result can be a decimal (e.g., 272 * 1.3 = 353.6). Some printer firmware metadata parsers (notably Creality K2) crash when parsing decimal values in flush_volumes_matrix, causing prints to get stuck at "File selected". This fix rounds the multiplied values to integers, ensuring compatibility with firmware that expects integer values in this field. Fixes compatibility with Creality K2 and potentially other Klipper-based printers that parse the CONFIG_BLOCK metadata. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- src/libslic3r/GCode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8f68631cab..23ab2a5849 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -5402,7 +5402,7 @@ void GCode::append_full_config(const Print &print, std::string &str) size_t temp_begin_t = idx * matrix_value_count, temp_end_t = (idx + 1) * matrix_value_count; std::transform(temp_flush_volumes_matrix.begin() + temp_begin_t, temp_flush_volumes_matrix.begin() + temp_end_t, temp_flush_volumes_matrix.begin() + temp_begin_t, - [temp_cfg_flush_multiplier_idx](double inputx) { return inputx * temp_cfg_flush_multiplier_idx; }); + [temp_cfg_flush_multiplier_idx](double inputx) { return std::round(inputx * temp_cfg_flush_multiplier_idx); }); } cfg.option("flush_volumes_matrix")->values = temp_flush_volumes_matrix; } else if (filament_count_tmp == 1) {