Skip to content

Commit

Permalink
Fixed Marlin support - remove G10 commands and multiple temp change p…
Browse files Browse the repository at this point in the history
…er extruder.
  • Loading branch information
nanoplane committed May 17, 2021
1 parent 4275819 commit 0690f14
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 48 deletions.
9 changes: 5 additions & 4 deletions resources/ui_layout/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,14 @@ group:Wipe tower
setting:wipe_tower_no_sparse_layers
setting:single_extruder_multi_material_priming
group:Wipe tower Mixer (must enable Wipe Tower)
line:Backflow purge
setting:wipe_mix_backflow
setting:wipe_mix_backflow_amt
end_line
line:Bubble purge
setting:wipe_mix_bubble
setting:wipe_mix_bubble_layers
setting:wipe_mix_bubble_volume
end_line
line:Backflow purge
setting:wipe_mix_backflow
setting:wipe_mix_backflow_volume
end_line
line: Two stage purge
setting:wipe_mix_two_stage
Expand Down
58 changes: 41 additions & 17 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeW
if (gcodegen.config().wipe_tower_no_sparse_layers.value) {
wipe_tower_z = m_last_wipe_tower_print_z;
ignore_sparse = (m_brim_done && m_tool_changes[m_layer_idx].size() == 1 && m_tool_changes[m_layer_idx].front().initial_tool == m_tool_changes[m_layer_idx].front().new_tool);
if (m_tool_change_idx == 0 && !ignore_sparse)
wipe_tower_z = m_last_wipe_tower_print_z + m_tool_changes[m_layer_idx].front().layer_height;
}
if (m_tool_change_idx == 0 && !ignore_sparse)
wipe_tower_z = m_last_wipe_tower_print_z + m_tool_changes[m_layer_idx].front().layer_height;
}

if (!ignore_sparse) {
if (!ignore_sparse) {
gcode += append_tcr(gcodegen, m_tool_changes[m_layer_idx][m_tool_change_idx++], extruder_id, wipe_tower_z);
m_last_wipe_tower_print_z = wipe_tower_z;
}
Expand Down Expand Up @@ -1366,16 +1366,18 @@ void GCode::_init_multiextruders(FILE *file, Print &print, GCodeWriter & writer,
{

//set tools and temp for reprap
if ((std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) ||
(std::set<uint8_t>{gcfMarlin}.count(print.config().gcode_flavor.value) > 0)) {
bool isMarlin = std::set<uint8_t>{gcfMarlin}.count(print.config().gcode_flavor.value) > 0;
bool isRepRap = std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0;

if (isRepRap) {
for (uint16_t tool_id : tool_ordering.all_extruders()) {
int standby_temp = int(print.config().temperature.get_at(tool_id));
if (standby_temp > 0) {
if (print.config().ooze_prevention.value)
standby_temp += print.config().standby_temperature_delta.value;
_write_format(file, "G10 P%d R%d ; sets the standby temperature\n",
tool_id,
standby_temp);
tool_id,
standby_temp);
}
}
_write_format(file, "\n"); // just to be clean
Expand Down Expand Up @@ -1774,6 +1776,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true);
if(print.config().first_layer_temperature.get_at(initial_extruder_id) != 0)
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true);
// Set the temp for any mixing extruders

// Do all objects for each layer.
if (print.config().complete_objects.value) {
Expand Down Expand Up @@ -2636,22 +2639,43 @@ void GCode::process_layer(
}
}
}

if (first_layer) {
if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) {
// set the temps for all the mixing extruders.
for (const Extruder &extruder : m_writer.extruders()) {
if (print.config().single_extruder_multi_material.value) {
if (print.config().single_extruder_mixer.get_at(extruder.id())) {
// set the temp for all mixing extruders so things don't lock up
// also, need to force a wait if the extruder id is the same as the writer id.
int temperature = print.config().first_layer_temperature.get_at(extruder.id());
bool do_wait = extruder.id() == m_writer.tool()->id();
if(temperature > 0) // don't set it if disabled
gcode += m_writer.set_temperature(temperature, do_wait, extruder.id());
}
}
}
}

}

if (! first_layer && ! m_second_layer_things_done) {
// Transition from 1st to 2nd layer. Adjust bed and nozzle temperatures as prescribed by the nozzle dependent
if(print.config().bed_temperature.get_at(first_extruder_id) > 0) // don't set it if disabled
gcode += m_writer.set_bed_temperature(print.config().bed_temperature.get_at(first_extruder_id));

// first_layer_temperature vs. temperature settings.
for (const Extruder &extruder : m_writer.extruders()) {
if (print.config().single_extruder_multi_material.value) {
if (extruder.id() == m_writer.tool()->id() || print.config().single_extruder_mixer.get_at(extruder.id())) {
// In single extruder multi material mode, set the temperature for the current extruder only.. unless we have mixer...
// also, need to force a wait if the extruder id is the same as the writer id.
int temperature = print.config().temperature.get_at(extruder.id());
bool do_wait = extruder.id() == m_writer.tool()->id();
if(temperature > 0) // don't set it if disabled
gcode += m_writer.set_temperature(temperature, do_wait, extruder.id());
if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) {
for (const Extruder &extruder : m_writer.extruders()) {
if (print.config().single_extruder_multi_material.value) {
if (extruder.id() == m_writer.tool()->id() || print.config().single_extruder_mixer.get_at(extruder.id())) {
// In single extruder multi material mode, set the temperature for the current extruder only.. unless we have mixer...
// also, need to force a wait if the extruder id is the same as the writer id.
int temperature = print.config().temperature.get_at(extruder.id());
bool do_wait = extruder.id() == m_writer.tool()->id();
if(temperature > 0) // don't set it if disabled
gcode += m_writer.set_temperature(temperature, do_wait, extruder.id());
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
toolchange_Load(writer, cleaning_box); // Prime the tool.
if (idx_tool + 1 == tools.size()) {
// Last tool should not be unloaded, but it should be wiped enough to become of a pure color.
toolchange_Wipe(writer, cleaning_box, wipe_volumes[tools[idx_tool-1]][tool]);
toolchange_Wipe(writer, cleaning_box, wipe_volumes[tools[idx_tool/*-1*/]][tool]);
} else {
// Ram the hot material out of the melt zone, retract the filament into the cooling tubes and let it cool.
//writer.travel(writer.x(), writer.y() + m_perimeter_width, 7200);
Expand Down
7 changes: 4 additions & 3 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,11 @@ const std::vector<std::string>& Preset::print_options()
"wipe_tower_no_sparse_layers",
"wipe_mix_backflow",
"wipe_mix_bubble",
"wipe_mix_two_stage",
"wipe_mix_backflow_amt",
"wipe_mix_bubble_layers",
"compatible_printers", "compatible_printers_condition", "inherits",
"wipe_mix_bubble_volume",
"wipe_mix_two_stage",
"wipe_mix_backflow_volume",
"compatible_printers", "compatible_printers_condition", "inherits",
"infill_dense", "infill_dense_algo",
"no_perimeter_unsupported_algo",
"support_material_solid_first_layer",
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2672,7 +2672,7 @@ bool Print::has_wipe_tower() const
return
! m_config.spiral_vase.value &&
m_config.wipe_tower.value &&
m_config.nozzle_diameter.values.size() > 1;
((m_config.nozzle_diameter.values.size() > 1) || m_config.wipe_mix_bubble);
}

const WipeTowerData& Print::wipe_tower_data(size_t extruders_cnt, double first_layer_height, double nozzle_diameter) const
Expand All @@ -2683,7 +2683,7 @@ const WipeTowerData& Print::wipe_tower_data(size_t extruders_cnt, double first_l
float width = float(m_config.wipe_tower_width);
float unscaled_brim_width = m_config.wipe_tower_brim.get_abs_value(nozzle_diameter);

const_cast<Print*>(this)->m_wipe_tower_data.depth = (900.f/width) * float(extruders_cnt - 1);
const_cast<Print*>(this)->m_wipe_tower_data.depth = (900.f/width) * float(extruders_cnt - 1) + (m_config.wipe_mix_bubble ? 1:0);
const_cast<Print*>(this)->m_wipe_tower_data.brim_width = unscaled_brim_width;
}

Expand All @@ -2707,7 +2707,7 @@ void Print::_make_wipe_tower()
// Let the ToolOrdering class know there will be initial priming extrusions at the start of the print.
m_wipe_tower_data.tool_ordering = ToolOrdering(*this, (unsigned int)-1, true);

if (! m_wipe_tower_data.tool_ordering.has_wipe_tower())
if (! m_wipe_tower_data.tool_ordering.has_wipe_tower() && ! m_config.wipe_mix_bubble)
// Don't generate any wipe tower.
return;

Expand Down
25 changes: 16 additions & 9 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4097,26 +4097,33 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("wipe_mix_bubble_volume", coFloat);
def->label = L("Bubble purge volume");
def->tooltip = L("Amount to purge during a bubble purge event");
def->mode = comExpert;
def->sidetext = L("mm^3");
def->set_default_value(new ConfigOptionFloat(10.0));

def = this->add("wipe_mix_bubble_layers", coInt);
def->label = L("Bubble Purge separation");
def->tooltip = L("This sets the number of layers between bubble purges. typically 10");
def->sidetext = L("layers between purges");
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(10));

def = this->add("wipe_mix_two_stage", coBool);
def->label = L("Enable two stage purge for Mixers");
def->tooltip = L("Setting this will perform a two stage purge on a tool change. This will first balance the contents of the mixing chamber by an additional purge of those filaments that will have a lower ratio on the next tool. then it will purge the chamber to the new ratios");
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("wipe_mix_backflow_amt", coFloat);
def = this->add("wipe_mix_backflow_volume", coFloat);
def->label = L("Volume for Backflow purge");
def->tooltip = L("This sets the amt for the backflow purge. it's usually quite small, (3 or 4mm^3)");
def->sidetext = L("mm^3");
def->sidetext = L("mm^3");
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(3.0));

def = this->add("wipe_mix_bubble_layers", coInt);
def->label = L("Bubble Purge separation");
def->tooltip = L("This sets the number of layers between bubble purges. typically 10");
def->sidetext = L("layers between purges");
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(10));

def = this->add("wipe_tower_brim", coFloatOrPercent);
def->label = L("Wipe tower brim width");
def->tooltip = L("Width of the brim for the wipe tower. Can be in mm of in % of the (assumed) only one nozzle diameter.");
Expand Down
10 changes: 6 additions & 4 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,10 @@ class PrintConfig : public MachineEnvelopeConfig, public GCodeConfig
ConfigOptionFloat wipe_tower_bridging;
ConfigOptionBool wipe_mix_backflow;
ConfigOptionBool wipe_mix_bubble;
ConfigOptionBool wipe_mix_two_stage;
ConfigOptionFloat wipe_mix_bubble_volume;
ConfigOptionInt wipe_mix_bubble_layers;
ConfigOptionFloat wipe_mix_backflow_amt;
ConfigOptionBool wipe_mix_two_stage;
ConfigOptionFloat wipe_mix_backflow_volume;
ConfigOptionFloats wiping_volumes_matrix;
ConfigOptionFloats wiping_volumes_extruders;
ConfigOptionFloat z_offset;
Expand Down Expand Up @@ -1440,9 +1441,10 @@ class PrintConfig : public MachineEnvelopeConfig, public GCodeConfig
OPT_PTR(wipe_tower_bridging);
OPT_PTR(wipe_mix_backflow);
OPT_PTR(wipe_mix_bubble);
OPT_PTR(wipe_mix_two_stage);
OPT_PTR(wipe_mix_backflow_amt);
OPT_PTR(wipe_mix_bubble_volume);
OPT_PTR(wipe_mix_bubble_layers);
OPT_PTR(wipe_mix_two_stage);
OPT_PTR(wipe_mix_backflow_volume);
OPT_PTR(wiping_volumes_matrix);
OPT_PTR(wiping_volumes_extruders);
OPT_PTR(z_offset);
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
bool have_wipe_tower = config->opt_bool("wipe_tower");
for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle",
"wipe_tower_bridging", "wipe_tower_brim", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming",
"wipe_mix_backflow", "wipe_mix_bubble", "wipe_mix_two_stage", "wipe_mix_backflow_amt",
"wipe_mix_backflow", "wipe_mix_bubble", "wipe_mix_bubble_volume", "wipe_mix_two_stage", "wipe_mix_backflow_volume",
"wipe_mix_bubble_layers"
})
toggle_field(el, have_wipe_tower);
Expand Down
9 changes: 5 additions & 4 deletions src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,9 +2197,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
unsigned int extruders_count = (unsigned int)dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"))->values.size();

bool wt = dynamic_cast<const ConfigOptionBool*>(m_config->option("wipe_tower"))->value;
bool bp = dynamic_cast<const ConfigOptionBool*>(m_config->option("wipe_mix_bubble"))->value;
bool co = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects"))->value;

if ((extruders_count > 1) && wt && !co) {
// **mtr count > 1 or bubble purge
if (((extruders_count > 1) || bp) && wt && !co) {
// Height of a print (Show at least a slab)
double height = std::max(m_model->bounding_box().max(2), 10.0);

Expand Down Expand Up @@ -6080,7 +6081,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector<std::string>& str_

static const float* color_support() { static float color[4] = { 0.5f, 1.0f, 0.5f, 1.f }; return color; } // greenish

// For cloring by a tool, return a parsed color.
// For coloring by a tool, return a parsed color.
bool color_by_tool() const { return tool_colors != nullptr; }
size_t number_tools() const { return this->color_by_tool() ? tool_colors->size() / 4 : 0; }
const float* color_tool(size_t tool) const { return tool_colors->data() + tool * 4; }
Expand Down Expand Up @@ -6145,7 +6146,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector<std::string>& str_
const std::vector<WipeTower::ToolChangeResult> &layer = ctxt.tool_change(idx_layer);
for (size_t i = 0; i < vols.size(); ++i) {
GLVolume &vol = *vols[i];
if (vol.print_zs.empty() || vol.print_zs.back() != layer.front().print_z) {
if (layer.size() > 0 && ( vol.print_zs.empty() || vol.print_zs.back() != layer.front().print_z)) {
vol.print_zs.emplace_back(layer.front().print_z);
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
Expand Down
6 changes: 6 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"brim_width", "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material",
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle",
"wipe_tower_brim", "extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology",
"wipe_mix_backflow",
"wipe_mix_bubble",
"wipe_mix_bubble_volume",
"wipe_mix_two_stage",
"wipe_mix_backflow_volume",
"wipe_mix_bubble_layers",
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
"layer_height", "first_layer_height", "min_layer_height", "max_layer_height",
"brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "top_solid_layers",
Expand Down
4 changes: 2 additions & 2 deletions version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set(SLIC3R_APP_NAME "SuperSlicerMx")
set(SLIC3R_APP_KEY "SuperSlicerMx")
set(SLIC3R_VERSION "2.3.55")
set(SLIC3R_VERSION_FULL "2.3.55.5")
set(SLIC3R_VERSION_FULL "2.3.55.5.1")
set(SLIC3R_BUILD_ID "SuperSlicerMx_${SLIC3R_VERSION_FULL}")
set(SLIC3R_RC_VERSION "2,3,55,5")
set(SLIC3R_RC_VERSION "2,3,55,5.1")
set(SLIC3R_RC_VERSION_DOTS "${SLIC3R_VERSION_FULL}")

0 comments on commit 0690f14

Please sign in to comment.