Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libslic3r/PrintConfig.cpp6
-rw-r--r--src/libslic3r/PrintConfig.hpp1
-rw-r--r--src/slic3r/Utils/OctoPrint.cpp55
-rw-r--r--src/slic3r/Utils/OctoPrint.hpp19
-rw-r--r--src/slic3r/Utils/PrintHost.cpp1
5 files changed, 75 insertions, 7 deletions
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index ba62159db..90e924044 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -106,6 +106,7 @@ static const t_config_enum_values s_keys_map_PrintHostType{
{"klipper", htKlipper},
{"mpmdv2", htMPMDv2},
{"mks", htMKS },
+ {"monoprice", htMiniDeltaLCD },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrintHostType)
@@ -3578,7 +3579,8 @@ void PrintConfigDef::init_fff_params()
def->label = L("Host Type");
def->category = OptionCategory::general;
def->tooltip = L("Slic3r can upload G-code files to a printer host. This field must contain "
- "the kind of the host.");
+ "the kind of the host."
+ "\nPrusaLink is only available for prusa printer.");
def->enum_keys_map = &ConfigOptionEnum<PrintHostType>::get_enum_values();
def->enum_values.push_back("prusalink");
def->enum_values.push_back("octoprint");
@@ -3589,6 +3591,7 @@ void PrintConfigDef::init_fff_params()
def->enum_values.push_back("klipper");
def->enum_values.push_back("mpmdv2");
def->enum_values.push_back("mks");
+ def->enum_values.push_back("monoprice");
def->enum_labels.push_back("PrusaLink");
def->enum_labels.push_back("OctoPrint");
def->enum_labels.push_back("Duet");
@@ -3598,6 +3601,7 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back("Klipper");
def->enum_labels.push_back("MPMDv2");
def->enum_labels.push_back("MKS");
+ def->enum_labels.push_back("Monoprice lcd");
def->mode = comAdvancedE | comPrusa;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp
index 59fe47f92..d0f710a49 100644
--- a/src/libslic3r/PrintConfig.hpp
+++ b/src/libslic3r/PrintConfig.hpp
@@ -90,6 +90,7 @@ enum PrintHostType {
htKlipper,
htMPMDv2,
htMKS,
+ htMiniDeltaLCD,
};
enum AuthorizationType {
diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp
index 80546ec39..fc7796873 100644
--- a/src/slic3r/Utils/OctoPrint.cpp
+++ b/src/slic3r/Utils/OctoPrint.cpp
@@ -199,6 +199,7 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
#ifdef WIN32
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
+ // the workaround is needed if it's not https, as a host ip and has allow_ip_resolve to 1
if (m_host.find("https://") == 0 || test_msg_or_host_ip.empty() || GUI::get_app_config()->get("allow_ip_resolve") != "1")
#endif // _WIN32
{
@@ -227,12 +228,10 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
% upload_parent_path.string()
% (upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false");
- auto http = Http::post(std::move(url));
+ Http http = Http::post(std::move(url));
set_auth(http);
- http.form_add("print", upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false")
- .form_add("path", upload_parent_path.string()) // XXX: slashes on windows ???
- .form_add_file("file", upload_data.source_path.string(), upload_filename.string())
- .on_complete([&](std::string body, unsigned status) {
+ set_http_send(http, upload_data);
+ http.on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
})
.on_error([&](std::string body, std::string error, unsigned status) {
@@ -256,6 +255,15 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
return res;
}
+void OctoPrint::set_http_send(Http& http, const PrintHostUpload& upload_data) const
+{
+ const auto upload_filename = upload_data.upload_path.filename();
+ const auto upload_parent_path = upload_data.upload_path.parent_path();
+ http.form_add("print", upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false")
+ .form_add("path", upload_parent_path.string()) // XXX: slashes on windows ???
+ .form_add_file("file", upload_data.source_path.string(), upload_filename.string());
+}
+
bool OctoPrint::validate_version_text(const boost::optional<std::string> &version_text) const
{
return version_text ? boost::starts_with(*version_text, "OctoPrint") : true;
@@ -287,6 +295,42 @@ std::string OctoPrint::make_url(const std::string &path) const
}
}
+// ------------ MiniDeltaLCD ------------
+
+MiniDeltaLCD::MiniDeltaLCD(DynamicPrintConfig* config) :
+ OctoPrint(config)
+{
+}
+
+void MiniDeltaLCD::set_http_send(Http& http, const PrintHostUpload& upload_data) const
+{
+ const auto upload_filename = upload_data.upload_path.filename();
+ const auto upload_parent_path = upload_data.upload_path.parent_path();
+ http.form_add_file("file", upload_data.source_path.string(), upload_filename.string())
+ .form_add("select", "true")
+ .form_add("print", upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false");
+}
+
+const char* MiniDeltaLCD::get_name() const { return "MiniDeltaLCD"; }
+
+wxString MiniDeltaLCD::get_test_ok_msg() const
+{
+ return wxString::Format(_L("Connection to %s works correctly."), "Monoprice lcd");
+}
+
+wxString MiniDeltaLCD::get_test_failed_msg(wxString& msg) const
+{
+ return GUI::from_u8((boost::format("%s: %s")
+ % _utf8(L("Could not connect to Monoprice lcd"))
+ % std::string(msg.ToUTF8())).str());
+}
+
+bool MiniDeltaLCD::validate_version_text(const boost::optional<std::string>& version_text) const
+{
+ return version_text ? boost::starts_with(*version_text, "MiniDeltaLCD") : false;
+}
+
+// SL1Host
SL1Host::SL1Host(DynamicPrintConfig *config) :
OctoPrint(config),
m_authorization_type(dynamic_cast<const ConfigOptionEnum<AuthorizationType>*>(config->option("printhost_authorization_type"))->value),
@@ -295,7 +339,6 @@ SL1Host::SL1Host(DynamicPrintConfig *config) :
{
}
-// SL1Host
const char* SL1Host::get_name() const { return "SL1Host"; }
wxString SL1Host::get_test_ok_msg () const
diff --git a/src/slic3r/Utils/OctoPrint.hpp b/src/slic3r/Utils/OctoPrint.hpp
index 0ab577484..e84f9a9af 100644
--- a/src/slic3r/Utils/OctoPrint.hpp
+++ b/src/slic3r/Utils/OctoPrint.hpp
@@ -36,6 +36,7 @@ public:
protected:
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
+ virtual void set_http_send(Http& request, const PrintHostUpload& upload_data) const;
private:
std::string m_host;
@@ -48,6 +49,24 @@ private:
std::string make_url(const std::string &path) const;
};
+class MiniDeltaLCD : public OctoPrint
+{
+public:
+ MiniDeltaLCD(DynamicPrintConfig* config);
+ ~MiniDeltaLCD() override = default;
+
+ const char* get_name() const override;
+
+ wxString get_test_ok_msg() const override;
+ wxString get_test_failed_msg(wxString& msg) const override;
+ PrintHostPostUploadActions get_post_upload_actions() const override { return {}; }
+
+protected:
+ bool validate_version_text(const boost::optional<std::string>& version_text) const override;
+ void set_http_send(Http& request, const PrintHostUpload& upload_data) const override;
+
+};
+
class SL1Host: public OctoPrint
{
public:
diff --git a/src/slic3r/Utils/PrintHost.cpp b/src/slic3r/Utils/PrintHost.cpp
index bdd2d9acf..6e77e4557 100644
--- a/src/slic3r/Utils/PrintHost.cpp
+++ b/src/slic3r/Utils/PrintHost.cpp
@@ -72,6 +72,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
case htMPMDv2: return new MPMDv2(config);
case htPrusaLink: return new PrusaLink(config);
case htMKS: return new MKS(config);
+ case htMiniDeltaLCD: return new MiniDeltaLCD(config);
default: return nullptr;
}
} else {