Wipe tower: Sparse layers are not included in filament consumption in case that the 'no sparse layers' option is set

This commit is contained in:
Lukas Matena 2019-10-01 11:41:37 +02:00
parent abaebb489a
commit b5e3899267
3 changed files with 11 additions and 5 deletions

View file

@ -471,6 +471,7 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
m_z_pos(0.f),
m_is_first_layer(false),
m_bridging(float(config.wipe_tower_bridging)),
m_no_sparse_layers(config.wipe_tower_no_sparse_layers),
m_gcode_flavor(config.gcode_flavor),
m_current_tool(initial_tool),
wipe_volumes(wiping_matrix)
@ -1136,9 +1137,10 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
writer.set_initial_position((m_left_to_right ? fill_box.ru : fill_box.lu), // so there is never a diagonal travel
m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
bool toolchanges_on_layer = m_layer_info->toolchanges_depth() > WT_EPSILON;
box_coordinates box = fill_box;
for (int i=0;i<2;++i) {
if (m_layer_info->toolchanges_depth() < WT_EPSILON) { // there were no toolchanges on this layer
if (! toolchanges_on_layer) {
if (i==0) box.expand(m_perimeter_width);
else box.expand(-m_perimeter_width);
}
@ -1192,9 +1194,12 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
m_depth_traversed = m_wipe_tower_depth-m_perimeter_width;
// Ask our writer about how much material was consumed:
if (m_current_tool < m_used_filament_length.size())
m_used_filament_length[m_current_tool] += writer.get_and_reset_used_filament_length();
// Ask our writer about how much material was consumed.
// Skip this in case the layer is sparse and config option to not print sparse layers is enabled.
if (! m_no_sparse_layers || toolchanges_on_layer)
if (m_current_tool < m_used_filament_length.size())
m_used_filament_length[m_current_tool] += writer.get_and_reset_used_filament_length();
ToolChangeResult result;
result.priming = false;

View file

@ -218,6 +218,7 @@ private:
float m_parking_pos_retraction = 0.f;
float m_extra_loading_move = 0.f;
float m_bridging = 0.f;
bool m_no_sparse_layers = false;
bool m_set_extruder_trimpot = false;
bool m_adhesion = true;
GCodeFlavor m_gcode_flavor;

View file

@ -143,7 +143,6 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"use_volumetric_e",
"variable_layer_height",
"wipe",
"wipe_tower_no_sparse_layers",
"wipe_tower_x",
"wipe_tower_y",
"wipe_tower_rotation_angle"
@ -201,6 +200,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|| opt_key == "wipe_tower"
|| opt_key == "wipe_tower_width"
|| opt_key == "wipe_tower_bridging"
|| opt_key == "wipe_tower_no_sparse_layers"
|| opt_key == "wiping_volumes_matrix"
|| opt_key == "parking_pos_retraction"
|| opt_key == "cooling_tube_retraction"