mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
* 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
79 lines
3.4 KiB
C++
79 lines
3.4 KiB
C++
#ifndef slic3r_FlashForge_hpp_
|
|
#define slic3r_FlashForge_hpp_
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <wx/string.h>
|
|
#include "PrintHost.hpp"
|
|
#include "SerialMessage.hpp"
|
|
#include "SerialMessageType.hpp"
|
|
#include "../../libslic3r/PrintConfig.hpp"
|
|
|
|
namespace Slic3r {
|
|
class DynamicPrintConfig;
|
|
class Http;
|
|
|
|
struct FlashforgeMaterialSlot
|
|
{
|
|
int slot_id {0}; // API is 1-based.
|
|
bool has_filament {false};
|
|
std::string material_name;
|
|
std::string material_color;
|
|
};
|
|
|
|
struct FlashforgeDiscoveredPrinter
|
|
{
|
|
std::string name;
|
|
std::string serial_number;
|
|
std::string ip_address;
|
|
};
|
|
|
|
class Flashforge : public PrintHost
|
|
{
|
|
public:
|
|
explicit Flashforge(DynamicPrintConfig *config);
|
|
~Flashforge() override = default;
|
|
|
|
const char *get_name() const override;
|
|
|
|
bool test(wxString &curl_msg) const override;
|
|
wxString get_test_ok_msg() const override;
|
|
wxString get_test_failed_msg(wxString &msg) const override;
|
|
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const override;
|
|
bool has_auto_discovery() const override { return true; }
|
|
bool can_test() const override { return true; }
|
|
PrintHostPostUploadActions get_post_upload_actions() const override { return PrintHostPostUploadAction::StartPrint; }
|
|
std::string get_host() const override { return m_host; }
|
|
bool fetch_material_slots(std::vector<FlashforgeMaterialSlot>& slots, bool* supports_material_station, wxString& msg) const;
|
|
static bool discover_printers(std::vector<FlashforgeDiscoveredPrinter>& printers, wxString& msg, int timeout_ms = 10000, int idle_timeout_ms = 1500, int max_retries = 3);
|
|
|
|
private:
|
|
std::string m_host;
|
|
std::string m_serial_number;
|
|
std::string m_check_code;
|
|
std::string m_console_port;
|
|
const int m_bufferSize;
|
|
GCodeFlavor m_gcFlavor;
|
|
Slic3r::Utils::SerialMessage controlCommand = {"~M601 S1\r\n",Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage connectKlipperCommand = {"~M640\r\n",Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage connectLegacyCommand = {"~M650\r\n",Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage nozzlePosCommand = {"~M114\r\n", Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage deviceInfoCommand = {"~M115\r\n", Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage statusCommand = {"~M119\r\n",Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage tempStatusCommand = {"~M105\r\n", Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage printStatusCommand = {"~M27\r\n", Slic3r::Utils::Command};
|
|
Slic3r::Utils::SerialMessage saveFileCommand = {"~M29\r\n",Slic3r::Utils::Command};
|
|
bool upload_local_api(PrintHostUpload upload_data, ProgressFn progress_fn, ErrorFn error_fn) const;
|
|
bool test_local_api(wxString& msg) const;
|
|
bool request_local_api_json(const std::string& path, const std::string& body, std::string& response_body, wxString& error_msg) const;
|
|
std::string make_http_url(const std::string& path) const;
|
|
std::string extract_host_name() const;
|
|
int get_err_code_from_body(const std::string &body) const;
|
|
bool connect(wxString& msg) const;
|
|
bool start_print(wxString& msg, const std::string& filename) const;
|
|
};
|
|
|
|
} // namespace Slic3r
|
|
|
|
#endif
|