From ad5ae50933375f22337fc23dc3a930c8c672b8a5 Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Tue, 24 Mar 2020 10:04:21 +0100
Subject: [PATCH 1/3] Fix of Crash when trying to set up non-existent flashair
 (#3899) fixed a typo in formatting text, throwing an exception.

---
 src/slic3r/Utils/FlashAir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/slic3r/Utils/FlashAir.cpp b/src/slic3r/Utils/FlashAir.cpp
index bca331e84..be963e98d 100644
--- a/src/slic3r/Utils/FlashAir.cpp
+++ b/src/slic3r/Utils/FlashAir.cpp
@@ -70,7 +70,7 @@ wxString FlashAir::get_test_ok_msg () const
 
 wxString FlashAir::get_test_failed_msg (wxString &msg) const
 {
-    return GUI::from_u8((boost::format("%s: %s")
+    return GUI::from_u8((boost::format("%s: %s\n%s")
                     % _utf8(L("Could not connect to FlashAir"))
                     % std::string(msg.ToUTF8())
                     % _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());

From 015a4a37dc8697725128d6e4107a5ea546b5c558 Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Tue, 24 Mar 2020 11:52:43 +0100
Subject: [PATCH 2/3] Fix of a wrong order of processing the config sources
 when slicing from command line. Fixes PrusaSlicer Console --load
 my_config.ini doesnt overwrites the 3mf profiles or not used. #3893

The priority of config values is now:

1) Config keys from command line, for example --fill-pattern=stars
   (highest priority, overwrites everything below)
2) Config files loaded with --load
3) Config from 3mf
   (lowest priority)
---
 src/PrusaSlicer.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp
index 048aea886..3611b1c04 100644
--- a/src/PrusaSlicer.cpp
+++ b/src/PrusaSlicer.cpp
@@ -132,14 +132,18 @@ int CLI::run(int argc, char **argv)
         Model model;
         try {
             // When loading an AMF or 3MF, config is imported as well, including the printer technology.
-            model = Model::read_from_file(file, &m_print_config, true);
-            PrinterTechnology other_printer_technology = get_printer_technology(m_print_config);
+            DynamicPrintConfig config;
+            model = Model::read_from_file(file, &config, true);
+            PrinterTechnology other_printer_technology = get_printer_technology(config);
             if (printer_technology == ptUnknown) {
                 printer_technology = other_printer_technology;
             } else if (printer_technology != other_printer_technology && other_printer_technology != ptUnknown) {
                 boost::nowide::cerr << "Mixing configurations for FFF and SLA technologies" << std::endl;
                 return 1;
             }
+            // config is applied to m_print_config before the current m_config values.
+            config += std::move(m_print_config);
+            m_print_config = std::move(config);
         } catch (std::exception &e) {
             boost::nowide::cerr << file << ": " << e.what() << std::endl;
             return 1;

From c3a9915fa1fd02cd0954c2808f80280f679714f4 Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Tue, 24 Mar 2020 11:59:55 +0100
Subject: [PATCH 3/3] Added the order of the print parameter priorities when
 slicing from command line to command line help. Follow up on PrusaSlicer
 Console --load my_config.ini doesnt overwrites the 3mf profiles or not used.
 #3893

---
 src/PrusaSlicer.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp
index 3611b1c04..f758709b8 100644
--- a/src/PrusaSlicer.cpp
+++ b/src/PrusaSlicer.cpp
@@ -644,6 +644,14 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn
         << "Other options:" << std::endl;
         cli_misc_config_def.print_cli_help(boost::nowide::cout, false);
 
+    boost::nowide::cout
+        << std::endl
+        << "Print options are processed in the following order:" << std::endl
+        << "\t1) Config keys from the command line, for example --fill-pattern=stars" << std::endl
+        << "\t   (highest priority, overwrites everything below)" << std::endl
+        << "\t2) Config files loaded with --load" << std::endl
+	    << "\t3) Config values loaded from amf or 3mf files" << std::endl;
+
     if (include_print_options) {
         boost::nowide::cout << std::endl;
         print_config_def.print_cli_help(boost::nowide::cout, true, [printer_technology](const ConfigOptionDef &def)