From a5d363a9f4c59c662f05f81ea88242d255035d0e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 14 Dec 2020 14:19:35 +0100 Subject: [PATCH] Do not emit M1 gcode for firmwares other than Marlin (after MM priming) The M1 gcode is apparently only supported on Marlin, others do not support it or use it for something else This should fix #5441 --- src/libslic3r/GCode.cpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index fab7a7058..830fff8f9 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -413,14 +413,11 @@ namespace Slic3r { std::string WipeTowerIntegration::prime(GCode& gcodegen) { - assert(m_layer_idx == 0); std::string gcode; - for (const WipeTower::ToolChangeResult& tcr : m_priming) { if (! tcr.extrusions.empty()) gcode += append_tcr(gcodegen, tcr, tcr.new_tool); } - return gcode; } @@ -1243,18 +1240,30 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu bbox_print.merge(get_wipe_tower_extrusions_extents(print, twolayers_printz)); BoundingBoxf bbox_prime(get_wipe_tower_priming_extrusions_extents(print)); bbox_prime.offset(0.5f); - // Beep for 500ms, tone 800Hz. Yet better, play some Morse. - _write(file, this->retract()); - _write(file, "M300 S800 P500\n"); - if (bbox_prime.overlap(bbox_print)) { - // Wait for the user to remove the priming extrusions, otherwise they would - // get covered by the print. - _write(file, "M1 Remove priming towers and click button.\n"); - } - else { - // Just wait for a bit to let the user check, that the priming succeeded. - //TODO Add a message explaining what the printer is waiting for. This needs a firmware fix. - _write(file, "M1 S10\n"); + bool overlap = bbox_prime.overlap(bbox_print); + + if (print.config().gcode_flavor == gcfMarlin) { + _write(file, this->retract()); + _write(file, "M300 S800 P500\n"); // Beep for 500ms, tone 800Hz. + if (overlap) { + // Wait for the user to remove the priming extrusions. + _write(file, "M1 Remove priming towers and click button.\n"); + } else { + // Just wait for a bit to let the user check, that the priming succeeded. + //TODO Add a message explaining what the printer is waiting for. This needs a firmware fix. + _write(file, "M1 S10\n"); + } + } else { + // This is not Marlin, M1 command is probably not supported. + // (See https://github.com/prusa3d/PrusaSlicer/issues/5441.) + if (overlap) { + print.active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, + L("Your print is very close to the priming regions. " + "Make sure there is no collision.")); + } else { + // Just continue printing, no action necessary. + } + } } print.throw_if_canceled();