diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 51298f175..3dbbcc260 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2377,14 +2377,44 @@ void TabPrinter::build_fff() } } if (opt_key == "gcode_flavor") { - const int flavor = boost::any_cast(value); - bool supports_travel_acceleration = (flavor == int(gcfMarlinFirmware) || flavor == int(gcfRepRapFirmware)); - bool supports_min_feedrates = (flavor == int(gcfMarlinFirmware) || flavor == int(gcfMarlinLegacy)); + const GCodeFlavor flavor = static_cast(boost::any_cast(value)); + bool supports_travel_acceleration = (flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware); + bool supports_min_feedrates = (flavor == gcfMarlinFirmware || flavor == gcfMarlinLegacy); if (supports_travel_acceleration != m_supports_travel_acceleration || supports_min_feedrates != m_supports_min_feedrates) { m_rebuild_kinematics_page = true; m_supports_travel_acceleration = supports_travel_acceleration; m_supports_min_feedrates = supports_min_feedrates; } + + const bool is_silent_mode = m_config->option("silent_mode")->getBool(); + const bool is_emit_to_gcode = m_config->option("machine_limits_usage")->getInt() == static_cast(MachineLimitsUsage::EmitToGCode); + if ((flavor == gcfKlipper && is_emit_to_gcode) || (!m_supports_min_feedrates && is_silent_mode)) { + DynamicPrintConfig new_conf = *m_config; + wxString msg; + + if (flavor == gcfKlipper && is_emit_to_gcode) { + msg = _L("Emitting machine limits to G-code is not supported with Klipper G-code flavor.\n" + "The option was switched to \"Use for time estimate\"."); + + auto machine_limits_usage = static_cast*>(m_config->option("machine_limits_usage")->clone()); + machine_limits_usage->value = MachineLimitsUsage::TimeEstimateOnly; + new_conf.set_key_value("machine_limits_usage", machine_limits_usage); + } + + if (!m_supports_min_feedrates && is_silent_mode) { + if (!msg.IsEmpty()) + msg += "\n\n"; + msg += _L("Stealth mode for machine limits to G-code is not supported with selected G-code flavor.\n" + "The Stealth mode was suppressed."); + + auto silent_mode = static_cast(m_config->option("silent_mode")->clone()); + silent_mode->value = false; + new_conf.set_key_value("silent_mode", silent_mode); + } + + InfoDialog(parent(), _L("G-code flavor is switched"), msg).ShowModal(); + load_config(new_conf); + } } build_unregular_pages(); update_dirty();