mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 16:32:06 +00:00
Add Flashforge Adventurer 5 series local send workflow with IFS mapping (#12991)
* Add Flashforge AD5X local send dialog, IFS mapping, and LAN discovery * Refine Flashforge AD5X IFS dialog behavior * Refine Flashforge IFS slot selection dialog * Fix Flashforge printer selection and print mapping * Use 3MF for Flashforge local uploads * Generalize Flashforge local API handling * Handle Flashforge local API IFS support more robustly * Use selected plate filament info for Flashforge IFS mapping * Fix Flashforge current-plate mapping and widget sizing * Improve Flashforge IFS contrast and color matching * Fix Flashforge legacy plate export and upload naming Resolve PLATE_CURRENT_IDX before the legacy send-to-printhost path calls send_gcode so single-plate Flashforge 3MF exports target the selected plate instead of leaking the sentinel into export_3mf. Sanitize Flashforge upload names in one shared utility reused by both the dialog and the backend client. This keeps the UI-visible filename and the actual uploaded filename consistent and replaces printer-problematic characters such as '=' without scattering Flashforge-specific logic through the generic Plater flow. * Keep Flashforge upload filename sanitization in the backend only Drop the PrintHostSendDialog API changes and keep filename sanitization inside the Flashforge backend paths that actually talk to the printer. This keeps the generic send dialog flow untouched while still normalizing problematic upload names for both serial and local API uploads. * Only use the Flashforge IFS dialog for local API uploads * Use reported Flashforge IFS support without model fallback * Remove unused Flashforge slot uniqueness tracking * Include <array> for Flashforge discovery message
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "PrintHostDialogs.hpp"
|
||||
#include "../Utils/ASCIIFolding.hpp"
|
||||
#include "../Utils/PrintHost.hpp"
|
||||
#include "../Utils/Flashforge.hpp"
|
||||
#include "../Utils/UndoRedo.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
#include "BitmapCache.hpp"
|
||||
@@ -204,10 +206,37 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||
{
|
||||
auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, "printer_host_browser", _L("Browse") + " " + dots);
|
||||
m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) {
|
||||
BonjourDialog dialog(this, Preset::printer_technology(*m_config));
|
||||
if (dialog.show_and_lookup()) {
|
||||
m_optgroup->set_value("print_host", dialog.get_selected(), true);
|
||||
m_optgroup->get_field("print_host")->field_changed();
|
||||
const auto host_type = m_config->opt_enum<PrintHostType>("host_type");
|
||||
if (host_type == htFlashforge) {
|
||||
wxBusyCursor wait;
|
||||
std::vector<FlashforgeDiscoveredPrinter> printers;
|
||||
wxString error_msg;
|
||||
if (!Flashforge::discover_printers(printers, error_msg)) {
|
||||
show_error(this, error_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
wxArrayString choices;
|
||||
for (const auto& printer : printers)
|
||||
choices.Add(from_u8((boost::format("%1% (%2%) [%3%]") % printer.name % printer.ip_address % printer.serial_number).str()));
|
||||
|
||||
wxSingleChoiceDialog dialog(this, _L("Select a Flashforge printer"), _L("Discovered Printers"), choices);
|
||||
if (dialog.ShowModal() == wxID_OK) {
|
||||
const int idx = dialog.GetSelection();
|
||||
if (idx >= 0 && idx < static_cast<int>(printers.size())) {
|
||||
m_optgroup->set_value("print_host", from_u8(printers[idx].ip_address), true);
|
||||
m_optgroup->set_value("flashforge_serial_number", from_u8(printers[idx].serial_number), true);
|
||||
m_config->opt_string("print_host") = printers[idx].ip_address;
|
||||
m_config->opt_string("flashforge_serial_number") = printers[idx].serial_number;
|
||||
update_printhost_buttons();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BonjourDialog dialog(this, Preset::printer_technology(*m_config));
|
||||
if (dialog.show_and_lookup()) {
|
||||
m_optgroup->set_value("print_host", dialog.get_selected(), true);
|
||||
m_optgroup->get_field("print_host")->field_changed();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -329,6 +358,10 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||
option.opt.width = Field::def_width_wider();
|
||||
m_optgroup->append_single_option_line(option);
|
||||
|
||||
option = m_optgroup->get_option("flashforge_serial_number");
|
||||
option.opt.width = Field::def_width_wider();
|
||||
m_optgroup->append_single_option_line(option);
|
||||
|
||||
option = m_optgroup->get_option("printhost_port");
|
||||
option.opt.width = Field::def_width_wider();
|
||||
Line port_line = m_optgroup->create_single_option_line(option);
|
||||
@@ -685,13 +718,17 @@ void PhysicalPrinterDialog::update(bool printer_change)
|
||||
}
|
||||
|
||||
if (opt->value == htFlashforge) {
|
||||
m_optgroup->hide_field("printhost_apikey");
|
||||
m_optgroup->hide_field("printhost_authorization_type");
|
||||
}
|
||||
m_optgroup->show_field("printhost_apikey");
|
||||
m_optgroup->show_field("flashforge_serial_number");
|
||||
m_optgroup->hide_field("printhost_authorization_type");
|
||||
} else {
|
||||
m_optgroup->hide_field("flashforge_serial_number");
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_optgroup->set_value("host_type", int(PrintHostType::htOctoPrint), false);
|
||||
m_optgroup->hide_field("host_type");
|
||||
m_optgroup->hide_field("flashforge_serial_number");
|
||||
|
||||
m_optgroup->show_field("printhost_authorization_type");
|
||||
|
||||
@@ -809,7 +846,7 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
|
||||
void PhysicalPrinterDialog::check_host_key_valid()
|
||||
{
|
||||
std::vector<std::string> keys = {"print_host", "print_host_webui", "printhost_apikey", "printhost_cafile", "printhost_user", "printhost_password", "printhost_port"};
|
||||
std::vector<std::string> keys = {"print_host", "print_host_webui", "printhost_apikey", "flashforge_serial_number", "printhost_cafile", "printhost_user", "printhost_password", "printhost_port"};
|
||||
for (auto &key : keys) {
|
||||
auto it = m_config->option<ConfigOptionString>(key);
|
||||
if (!it) m_config->set_key_value(key, new ConfigOptionString(""));
|
||||
|
||||
Reference in New Issue
Block a user