UltiMaker S5 Profile + Local API Support (#14062)

* Add Ultimaker S5 Profile - WIP

* Add Ultimaker physical printer base

* Ultimaker API WIP for base update.

* Fix undefined reference error.

* Add UMS5 profile, add placeholders for testAuth stuff.

* Fix non-const func definitions, make func names align with style guide.

* Localization stuff? IDK if this does anything or is required.

* Add cover image

* Auth code cleanup, add UI button for auth cred generation, implement various auth checks and tests.

* Fix auth stuff

* Clean up code

* Get upload code sort-of working, fix typo

* Update printer settings and start/end gcodes

* Add makeGriffinCompatible preprocessor script to prevent machine crash, update machine profile.

* Fix buildplate size, fix time missing bug, add S5 buildplate model

* Correct capitalization to UltiMaker

* Fix display bug, fix capitalization bug

* Implement credential generation button and logic

* Fix generate auth creds button, add todos, fix capitalization.

* Actually fix generate auth credentials.

* Fix generate auth creds message.

* Update UM S5 machine limits

* Revert accidental commit.

* Fix postprocessor, clean up code.

* Update presets for multi-extruder printing.

* Add Single Extruder and Fast profiles.

* Code cleanup

* Register and validate the UltiMaker S5 presets

* Show the Generate API Key button only for UltiMaker print hosts

The PR added it to the Physical Printer dialog for every host type, where pressing it runs an ordinary connection test and reports "API Key created". Gate it on the selected host type instead.

* Drop unused lambda captures in the UltiMaker host code

clang promotes -Wunused-lambda-capture to an error under the project's -Werror, so the file failed to build on macOS; the five callbacks do not touch this.

* Fix the Windows build of the UltiMaker print host

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Drew Wingfield
2026-09-21 01:00:55 +08:00
committed by GitHub
co-authored by SoftFever
parent 505a46b280
commit 6e4be42a04
19 changed files with 1184 additions and 6 deletions
+62 -3
View File
@@ -265,6 +265,43 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
return sizer;
};
auto ultimaker_generate_creds = [=](wxWindow* parent) {
auto sizer = create_sizer_with_btn(parent, &m_printhost_generate_creds_btn, "ultimaker_generate_creds", _L("Generate API Key"));
m_printhost_generate_creds_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
if (!host) {
const wxString text = _L("Could not get a valid Printer Host reference");
show_error(this, text);
return;
}
wxString msg = "generate_auth_creds";
bool result;
{
// Show a wait cursor during the connection test, as it is blocking UI.
wxBusyCursor wait;
// Send request to printer for api key and such
result = host->test(msg); // using test with special input because I don't want to create the generate_auth_creds func for every printer
// Prompt user to approve access on the machine.
show_info(this, "API Key created. Go to the physical printer and hit \"authorize\" on the screen, then run \"Test\" again.\n"+msg, "API Key created.");
}
if (result)
show_info(this, host->get_test_ok_msg(), _L("Success!"));
else
show_error(this, host->get_test_failed_msg(msg));
update();
});
return sizer;
};
auto print_host_logout = [&](wxWindow* parent) {
auto sizer = create_sizer_with_btn(parent, &m_printhost_logout_btn, "", _L("Log Out"));
@@ -303,6 +340,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
Line host_line = m_optgroup->create_single_option_line(option);
host_line.append_widget(printhost_browse);
host_line.append_widget(print_host_test);
host_line.append_widget(ultimaker_generate_creds);
host_line.append_widget(print_host_logout);
m_optgroup->append_line(host_line);
@@ -606,8 +644,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
m_optgroup->hide_field("bbl_use_print_host_webui");
m_optgroup->enable_field("printhost_cafile");
m_optgroup->enable_field("printhost_ssl_ignore_revoke");
if (m_printhost_cafile_browse_btn)
m_printhost_cafile_browse_btn->Enable();
if (m_printhost_cafile_browse_btn) { m_printhost_cafile_browse_btn->Enable(); }
// hide pre-configured address, in case user switched to a different host type
if (Field* printhost_field = m_optgroup->get_field("print_host"); printhost_field) {
@@ -704,7 +741,24 @@ void PhysicalPrinterDialog::update(bool printer_change)
m_optgroup->hide_field("printhost_authorization_type");
} else {
m_optgroup->hide_field("flashforge_serial_number");
}
}
if (opt->value == htUltiMaker) {
m_optgroup->hide_field("printhost_apikey");
m_optgroup->hide_field("printhost_authorization_type");
m_optgroup->hide_field("bbl_use_print_host_webui");
m_optgroup->hide_field("printhost_cafile");
m_optgroup->show_field("printhost_user");
m_optgroup->show_field("printhost_password");
m_optgroup->enable_field("print_host");
m_optgroup->show_field("print_host_webui");
if (m_printhost_cafile_browse_btn) {
m_printhost_cafile_browse_btn->Disable();
}
if (m_printhost_generate_creds_btn) {
m_printhost_generate_creds_btn->Enable();
}
}
}
else {
m_optgroup->set_value("host_type", int(PrintHostType::htOctoPrint), false);
@@ -720,6 +774,10 @@ void PhysicalPrinterDialog::update(bool printer_change)
m_optgroup->show_field(opt_key, auth_type == AuthorizationType::atUserPassword);
}
// The "Generate API Key" button is only meaningful for UltiMaker printers.
if (m_printhost_generate_creds_btn)
m_printhost_generate_creds_btn->Show(tech == ptFFF && m_config->opt_enum<PrintHostType>("host_type") == htUltiMaker);
m_optgroup->show_field("printhost_port", supports_multiple_printers);
m_printhost_port_browse_btn->Show(supports_multiple_printers);
@@ -787,6 +845,7 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
m_printhost_browse_btn->Rescale();
m_printhost_test_btn->Rescale();
m_printhost_generate_creds_btn->Rescale();
m_printhost_logout_btn->Rescale();
if (m_printhost_cafile_browse_btn)
m_printhost_cafile_browse_btn->Rescale();