From f0e9ad46ece231ab76619331d6313b8df6425abf Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 30 Mar 2021 13:30:18 +0200 Subject: [PATCH] Renamed the gcfMarlin enum value to gcfMarlinLegacy so we never mistake it for the new one There should be no functional change. --- src/libslic3r/GCode.cpp | 6 +++--- src/libslic3r/GCode/GCodeProcessor.cpp | 18 +++++++++--------- src/libslic3r/GCode/WipeTower.cpp | 4 ++-- src/libslic3r/GCodeWriter.cpp | 4 ++-- src/libslic3r/Print.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 2 +- src/libslic3r/PrintConfig.hpp | 4 ++-- src/slic3r/GUI/Tab.cpp | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index ab2410104..68fbe62d5 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -784,7 +784,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re namespace DoExport { static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool& silent_time_estimator_enabled) { - silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlin || config.gcode_flavor == gcfMarlinFirmware) + silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlinLegacy || config.gcode_flavor == gcfMarlinFirmware) && config.silent_mode; processor.reset(); processor.apply_config(config); @@ -1356,7 +1356,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu bbox_prime.offset(0.5f); bool overlap = bbox_prime.overlap(bbox_print); - if (print.config().gcode_flavor == gcfMarlin || print.config().gcode_flavor == gcfMarlinFirmware) { + if (print.config().gcode_flavor == gcfMarlinLegacy || print.config().gcode_flavor == gcfMarlinFirmware) { _write(file, this->retract()); _write(file, "M300 S800 P500\n"); // Beep for 500ms, tone 800Hz. if (overlap) { @@ -1559,7 +1559,7 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc // Do not process this piece of G-code by the time estimator, it already knows the values through another sources. void GCode::print_machine_envelope(FILE *file, Print &print) { - if ((print.config().gcode_flavor.value == gcfMarlin || print.config().gcode_flavor.value == gcfMarlinFirmware) + if ((print.config().gcode_flavor.value == gcfMarlinLegacy || print.config().gcode_flavor.value == gcfMarlinFirmware) && print.config().machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) { fprintf(file, "M201 X%d Y%d Z%d E%d ; sets maximum accelerations, mm/sec^2\n", int(print.config().machine_max_acceleration_x.values.front() + 0.5), diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 7c89cf467..be408c08f 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -823,7 +823,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config) m_filament_diameters[i] = static_cast(config.filament_diameter.values[i]); } - if (m_flavor == gcfMarlin && config.machine_limits_usage.value != MachineLimitsUsage::Ignore) + if (m_flavor == gcfMarlinLegacy && config.machine_limits_usage.value != MachineLimitsUsage::Ignore) m_time_processor.machine_limits = reinterpret_cast(config); // Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful. @@ -934,7 +934,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) } } - if (m_flavor == gcfMarlin) { + if (m_flavor == gcfMarlinLegacy) { const ConfigOptionFloats* machine_max_acceleration_x = config.option("machine_max_acceleration_x"); if (machine_max_acceleration_x != nullptr) m_time_processor.machine_limits.machine_max_acceleration_x.values = machine_max_acceleration_x->values; @@ -1646,23 +1646,23 @@ bool GCodeProcessor::process_cura_tags(const std::string_view comment) if (pos != comment.npos) { const std::string_view flavor = comment.substr(pos + tag.length()); if (flavor == "BFB") - m_flavor = gcfMarlin; // << ??????????????????????? + m_flavor = gcfMarlinLegacy; // << ??????????????????????? else if (flavor == "Mach3") m_flavor = gcfMach3; else if (flavor == "Makerbot") m_flavor = gcfMakerWare; else if (flavor == "UltiGCode") - m_flavor = gcfMarlin; // << ??????????????????????? + m_flavor = gcfMarlinLegacy; // << ??????????????????????? else if (flavor == "Marlin(Volumetric)") - m_flavor = gcfMarlin; // << ??????????????????????? + m_flavor = gcfMarlinLegacy; // << ??????????????????????? else if (flavor == "Griffin") - m_flavor = gcfMarlin; // << ??????????????????????? + m_flavor = gcfMarlinLegacy; // << ??????????????????????? else if (flavor == "Repetier") m_flavor = gcfRepetier; else if (flavor == "RepRap") m_flavor = gcfRepRapFirmware; else if (flavor == "Marlin") - m_flavor = gcfMarlin; + m_flavor = gcfMarlinLegacy; else BOOST_LOG_TRIVIAL(warning) << "GCodeProcessor found unknown flavor: " << flavor; @@ -2575,7 +2575,7 @@ void GCodeProcessor::process_M203(const GCodeReader::GCodeLine& line) // see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate // http://smoothieware.org/supported-g-codes - float factor = (m_flavor == gcfMarlin || m_flavor == gcfSmoothie) ? 1.0f : MMMIN_TO_MMSEC; + float factor = (m_flavor == gcfMarlinLegacy || m_flavor == gcfSmoothie) ? 1.0f : MMMIN_TO_MMSEC; for (size_t i = 0; i < static_cast(PrintEstimatedTimeStatistics::ETimeMode::Count); ++i) { if (static_cast(i) == PrintEstimatedTimeStatistics::ETimeMode::Normal || @@ -2749,7 +2749,7 @@ void GCodeProcessor::process_T(const std::string_view command) int eid = 0; if (! parse_number(command.substr(1), eid) || eid < 0 || eid > 255) { // Specific to the MMU2 V2 (see https://www.help.prusa3d.com/en/article/prusa-specific-g-codes_112173): - if (m_flavor == gcfMarlin && (command == "Tx" || command == "Tc" || command == "T?")) + if (m_flavor == gcfMarlinLegacy && (command == "Tx" || command == "Tc" || command == "T?")) return; // T-1 is a valid gcode line for RepRap Firmwares (used to deselects all tools) see https://github.com/prusa3d/PrusaSlicer/issues/5677 diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index f59ab341c..10c68d076 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -342,7 +342,7 @@ public: WipeTowerWriter& speed_override_backup() { // This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114) - if (m_gcode_flavor == gcfMarlin || m_gcode_flavor == gcfMarlinFirmware) + if (m_gcode_flavor == gcfMarlinLegacy || m_gcode_flavor == gcfMarlinFirmware) m_gcode += "M220 B\n"; return *this; } @@ -350,7 +350,7 @@ public: // Let the firmware restore the active speed override value. WipeTowerWriter& speed_override_restore() { - if (m_gcode_flavor == gcfMarlin || m_gcode_flavor == gcfMarlinFirmware) + if (m_gcode_flavor == gcfMarlinLegacy || m_gcode_flavor == gcfMarlinFirmware) m_gcode += "M220 R\n"; return *this; } diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 233f07b43..5bf0a30da 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -20,7 +20,7 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config) this->config.apply(print_config, true); m_extrusion_axis = this->config.get_extrusion_axis(); m_single_extruder_multi_material = print_config.single_extruder_multi_material.value; - bool is_marlin = print_config.gcode_flavor.value == gcfMarlin || print_config.gcode_flavor.value == gcfMarlinFirmware; + bool is_marlin = print_config.gcode_flavor.value == gcfMarlinLegacy || print_config.gcode_flavor.value == gcfMarlinFirmware; m_max_acceleration = std::lrint((is_marlin && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ? print_config.machine_max_acceleration_extruding.values.front() : 0); } @@ -49,7 +49,7 @@ std::string GCodeWriter::preamble() } if (FLAVOR_IS(gcfRepRapSprinter) || FLAVOR_IS(gcfRepRapFirmware) || - FLAVOR_IS(gcfMarlin) || + FLAVOR_IS(gcfMarlinLegacy) || FLAVOR_IS(gcfMarlinFirmware) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 2cb2940e6..ff433a48f 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1293,7 +1293,7 @@ std::string Print::validate(std::string* warning) const } if (m_config.gcode_flavor != gcfRepRapSprinter && m_config.gcode_flavor != gcfRepRapFirmware && - m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlin && m_config.gcode_flavor != gcfMarlinFirmware) + m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlinLegacy && m_config.gcode_flavor != gcfMarlinFirmware) return L("The Wipe Tower is currently only supported for the Marlin, RepRap/Sprinter, RepRapFirmware and Repetier G-code flavors."); if (! m_config.use_relative_e_distances) return L("The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1)."); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index b795eaf20..9c6ac2662 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3632,7 +3632,7 @@ std::string FullPrintConfig::validate() this->gcode_flavor.value != gcfSmoothie && this->gcode_flavor.value != gcfRepRapSprinter && this->gcode_flavor.value != gcfRepRapFirmware && - this->gcode_flavor.value != gcfMarlin && + this->gcode_flavor.value != gcfMarlinLegacy && this->gcode_flavor.value != gcfMarlinFirmware && this->gcode_flavor.value != gcfMachinekit && this->gcode_flavor.value != gcfRepetier) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 7f6ccf3c0..4f94f8859 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -24,7 +24,7 @@ namespace Slic3r { enum GCodeFlavor : unsigned char { - gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit, + gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinLegacy, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit, gcfSmoothie, gcfNoExtrusion, }; @@ -120,7 +120,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum::get keys_map["repetier"] = gcfRepetier; keys_map["teacup"] = gcfTeacup; keys_map["makerware"] = gcfMakerWare; - keys_map["marlin"] = gcfMarlin; + keys_map["marlin"] = gcfMarlinLegacy; keys_map["marlinfirmware"] = gcfMarlinFirmware; keys_map["sailfish"] = gcfSailfish; keys_map["smoothie"] = gcfSmoothie; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 1d10f3a8e..915fa5267 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2583,7 +2583,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) { size_t n_before_extruders = 2; // Count of pages before Extruder pages auto flavor = m_config->option>("gcode_flavor")->value; - bool is_marlin_flavor = (flavor == gcfMarlin || flavor == gcfMarlinFirmware); + bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware); /* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages * and be cause of application crash, when try to change Preset in moment, @@ -2854,7 +2854,7 @@ void TabPrinter::toggle_options() toggle_option("single_extruder_multi_material", have_multiple_extruders); auto flavor = m_config->option>("gcode_flavor")->value; - bool is_marlin_flavor = flavor == gcfMarlin || flavor == gcfMarlinFirmware; + bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware; // Disable silent mode for non-marlin firmwares. toggle_option("silent_mode", is_marlin_flavor); } @@ -2922,7 +2922,7 @@ void TabPrinter::toggle_options() } if (m_active_page->title() == "Machine limits" && m_machine_limits_description_line) { - assert(m_config->option>("gcode_flavor")->value == gcfMarlin + assert(m_config->option>("gcode_flavor")->value == gcfMarlinLegacy || m_config->option>("gcode_flavor")->value == gcfMarlinFirmware); const auto *machine_limits_usage = m_config->option>("machine_limits_usage"); bool enabled = machine_limits_usage->value != MachineLimitsUsage::Ignore;