Files
OrcaSlicer/src/slic3r/GUI/Widgets/FilamentLoad.hpp
SoftFever 0d31325df0 feat: Filament Track Switch (H2-series O2L-FTS) support
The Filament Track Switch (H2-series accessory, product code O2L-FTS) feeds
every AMS to both extruders through a two-track switch. Port full support
across the device layer, project config, and GUI.

Device / config:
- Model the switch-aware AMS binding (the set of extruders an AMS can feed
  and which input track A/B feeds it), switch readiness, the O2L-FTS firmware
  module, and the fun2 capability bit for checking a slice against installed
  hardware.
- Register has_filament_switcher and enable_filament_dynamic_map as project
  config that persists with the project and restores from a saved 3mf, and
  force both back to false on every project/printer/CLI load path. Live
  device sync is the only thing that sets them true.

GUI:
- Sidebar sync activates the switch from live device state, attributes each
  AMS to the extruder its input track feeds, shows a floating status icon
  (ready / not-calibrated), and surfaces a one-time tip / not-calibrated
  warning.
- Send dialog gains a non-blocking slice-vs-hardware mismatch warning and a
  blocking error when a slice needs dynamic nozzle mapping but the switch is
  missing or not set up.
- AMS load/unload guards, AMS-view routing glyph + un-calibrated banner +
  hidden external-spool road, and mapping-popup external-spool lockout.
- Filament pickers collapse the per-extruder split into a single deduplicated
  "AMS filaments" group with a smart-assign toggle when the switch is ready.
- Firmware-upgrade panel lists the O2L-FTS accessory and its version.
- Device-provided filament-change steps (ams.cfs) drive the change-step
  display when firmware sends them, including the three switch steps.
- "Load current filament" asks which extruder to feed via a
  FeedDirectionDialog when the switch is calibrated.

Inert without the accessory: every path is gated on the switch being
installed (MQTT aux bit 29, default off) or ready, both project flags default
false, and the per-extruder AMS attribution is byte-identical, so AMS state,
the send/load UI, and sliced g-code are unchanged for every printer that does
not report a Filament Track Switch.
2026-07-09 18:57:05 +08:00

66 lines
2.2 KiB
C++

#ifndef slic3r_GUI_FILAMENTLOAD_hpp_
#define slic3r_GUI_FILAMENTLOAD_hpp_
#include "../wxExtensions.hpp"
#include "StaticBox.hpp"
#include "StepCtrl.hpp"
#include "AMSControl.hpp"
#include "../DeviceManager.hpp"
#include "slic3r/GUI/Event.hpp"
#include "slic3r/GUI/AmsMappingPopup.hpp"
#include <wx/simplebook.h>
#include <wx/hyperlink.h>
#include <wx/animate.h>
#include <wx/dynarray.h>
namespace Slic3r { namespace GUI {
// The filament load panel
// (1) Load from empty, empty -> filled
// (2) Switch filament, fila_A -> fila_B*/
class FilamentLoad : public wxSimplebook
{
public:
FilamentLoad(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
protected:
::FilamentStepIndicator* m_filament_load_steps = { nullptr };
::FilamentStepIndicator* m_filament_unload_steps = { nullptr };
::FilamentStepIndicator* m_filament_vt_load_steps = { nullptr };
int m_ams_id = { 1 };
int m_slot_id = { 1 };
bool is_extrusion = false;
public:
std::map<FilamentStep, wxString> FILAMENT_CHANGE_STEP_STRING;
// Labels for the device-numbered steps reported by the AMS (ams.cfs). Keyed by the device
// enum, separate from the legacy FilamentStep map above. Only used when the AMS provides a
// step list; empty AMS list falls back to the legacy sequences below.
std::map<DevFilamentStep, wxString> DEV_FILAMENT_CHANGE_STEP_STRING;
AMSModel m_ams_model{ AMSModel::GENERIC_AMS };
AMSModel m_ext_model{ AMSModel::AMS_LITE };
AMSModel m_is_none_ams_mode{ AMSModel::AMS_LITE };
void SetAmsModel(AMSModel mode, AMSModel ext_mode) { m_ams_model = mode; m_ext_model = ext_mode; };
void SetFilamentStep(FilamentStep item_idx, FilamentStepType f_type);
void ShowFilamentTip(bool hasams = true);
void SetupSteps(MachineObject* obj_, bool is_extrusion_exist);
void show_nofilament_mode(bool show);
void updateID(int ams_id, int slot_id) { m_ams_id = ams_id; m_slot_id = slot_id; };
void SetExt(bool ext) { is_extrusion = ext; };
void set_min_size(const wxSize& minSize);
void set_max_size(const wxSize& maxSize);
void set_background_color(const wxColour& colour);
};
}}
#endif // !slic3r_GUI_filamentload_hpp_