From f02821a82dcb61311d32178989601aca920d366b Mon Sep 17 00:00:00 2001
From: Vojtech Bubnik <bubnikv@gmail.com>
Date: Tue, 29 Jun 2021 17:55:23 +0200
Subject: [PATCH] Renamed the "marlinfirmware" firmware flavor to "marlin2".

---
 resources/profiles/PrusaResearch.ini |  2 +-
 src/libslic3r/PrintConfig.cpp        | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini
index f95c2b61c..57b185872 100644
--- a/resources/profiles/PrusaResearch.ini
+++ b/resources/profiles/PrusaResearch.ini
@@ -6325,7 +6325,7 @@ thumbnails = 16x16,220x124
 bed_shape = 0x0,180x0,180x180,0x180
 default_filament_profile = "Prusament PLA"
 default_print_profile = 0.15mm QUALITY @MINI
-gcode_flavor = marlinfirmware
+gcode_flavor = marlin2
 machine_max_acceleration_e = 5000
 machine_max_acceleration_extruding = 1250
 machine_max_acceleration_retracting = 1250
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index a1d86d469..76dbac263 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -50,7 +50,7 @@ static t_config_enum_values s_keys_map_GCodeFlavor {
     { "teacup",         gcfTeacup },
     { "makerware",      gcfMakerWare },
     { "marlin",         gcfMarlinLegacy },
-    { "marlinfirmware", gcfMarlinFirmware },
+    { "marlin2",        gcfMarlinFirmware },
     { "sailfish",       gcfSailfish },
     { "smoothie",       gcfSmoothie },
     { "mach3",          gcfMach3 },
@@ -1253,7 +1253,7 @@ void PrintConfigDef::init_fff_params()
     def->enum_values.push_back("teacup");
     def->enum_values.push_back("makerware");
     def->enum_values.push_back("marlin");
-    def->enum_values.push_back("marlinfirmware");
+    def->enum_values.push_back("marlin2");
     def->enum_values.push_back("sailfish");
     def->enum_values.push_back("mach3");
     def->enum_values.push_back("machinekit");
@@ -3618,8 +3618,12 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
         } catch (boost::bad_lexical_cast &) {
             value = "0";
         }
-    } else if (opt_key == "gcode_flavor" && value == "makerbot") {
-        value = "makerware";
+    } else if (opt_key == "gcode_flavor") {
+        if (value == "makerbot")
+            value = "makerware";
+        else if (value == "marlinfirmware")
+            // the "new" marlin firmware flavor used to be called "marlinfirmware" for some time during PrusaSlicer 2.4.0-alpha development.
+            value = "marlin2";
     } else if (opt_key == "fill_density" && value.find("%") == std::string::npos) {
         try {
             // fill_density was turned into a percent value