FIX: missing flush for small purge length
1.Caused by round(), if purge volume is small, flush count may be 0 due to round() Github:#4738 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I382ab3021761c2fcc84d3537a18bd619637985b8
This commit is contained in:
parent
43e4569f55
commit
2e243b3e76
|
@ -508,6 +508,9 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
|
|||
config.set_key_value("flush_length", new ConfigOptionFloat(purge_length));
|
||||
|
||||
int flush_count = std::min(g_max_flush_count, (int)std::round(purge_volume / g_purge_volume_one_time));
|
||||
// handle cases for very small purge
|
||||
if (flush_count == 0 && purge_volume > 0)
|
||||
flush_count += 1;
|
||||
float flush_unit = purge_length / flush_count;
|
||||
int flush_idx = 0;
|
||||
for (; flush_idx < flush_count; flush_idx++) {
|
||||
|
@ -5570,6 +5573,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b
|
|||
dyn_config.set_key_value("flush_length", new ConfigOptionFloat(wipe_length));
|
||||
|
||||
int flush_count = std::min(g_max_flush_count, (int)std::round(wipe_volume / g_purge_volume_one_time));
|
||||
// handle cases for very small purge
|
||||
if (flush_count == 0 && wipe_volume > 0)
|
||||
flush_count += 1;
|
||||
float flush_unit = wipe_length / flush_count;
|
||||
int flush_idx = 0;
|
||||
for (; flush_idx < flush_count; flush_idx++) {
|
||||
|
|
Loading…
Reference in New Issue