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
This commit is contained in:
Lukas Matena 2020-12-14 14:19:35 +01:00
parent 26755eb1d1
commit a5d363a9f4

View file

@ -413,14 +413,11 @@ namespace Slic3r {
std::string WipeTowerIntegration::prime(GCode& gcodegen) std::string WipeTowerIntegration::prime(GCode& gcodegen)
{ {
assert(m_layer_idx == 0);
std::string gcode; std::string gcode;
for (const WipeTower::ToolChangeResult& tcr : m_priming) { for (const WipeTower::ToolChangeResult& tcr : m_priming) {
if (! tcr.extrusions.empty()) if (! tcr.extrusions.empty())
gcode += append_tcr(gcodegen, tcr, tcr.new_tool); gcode += append_tcr(gcodegen, tcr, tcr.new_tool);
} }
return gcode; return gcode;
} }
@ -1243,19 +1240,31 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
bbox_print.merge(get_wipe_tower_extrusions_extents(print, twolayers_printz)); bbox_print.merge(get_wipe_tower_extrusions_extents(print, twolayers_printz));
BoundingBoxf bbox_prime(get_wipe_tower_priming_extrusions_extents(print)); BoundingBoxf bbox_prime(get_wipe_tower_priming_extrusions_extents(print));
bbox_prime.offset(0.5f); bbox_prime.offset(0.5f);
// Beep for 500ms, tone 800Hz. Yet better, play some Morse. bool overlap = bbox_prime.overlap(bbox_print);
if (print.config().gcode_flavor == gcfMarlin) {
_write(file, this->retract()); _write(file, this->retract());
_write(file, "M300 S800 P500\n"); _write(file, "M300 S800 P500\n"); // Beep for 500ms, tone 800Hz.
if (bbox_prime.overlap(bbox_print)) { if (overlap) {
// Wait for the user to remove the priming extrusions, otherwise they would // Wait for the user to remove the priming extrusions.
// get covered by the print.
_write(file, "M1 Remove priming towers and click button.\n"); _write(file, "M1 Remove priming towers and click button.\n");
} } else {
else {
// Just wait for a bit to let the user check, that the priming succeeded. // 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. //TODO Add a message explaining what the printer is waiting for. This needs a firmware fix.
_write(file, "M1 S10\n"); _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(); print.throw_if_canceled();
} }