mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-04-06 00:32:05 +02:00
fix: round flush_volumes_matrix values to integers (#12672)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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<ConfigOptionFloats>("flush_volumes_matrix")->values = temp_flush_volumes_matrix;
|
||||
} else if (filament_count_tmp == 1) {
|
||||
|
||||
Reference in New Issue
Block a user