mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 09:07:39 +00:00
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.
This commit is contained in:
@@ -174,6 +174,9 @@ FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, w
|
||||
button_labels[idx]->Bind(wxEVT_LEAVE_WINDOW, [this](auto &) { UpdateButtonStatus(); });
|
||||
}
|
||||
|
||||
// Smart filament assign section
|
||||
MakeSmartFilamentSection(top_sizer, horizontal_margin, vertical_padding);
|
||||
|
||||
{
|
||||
wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
// ORCA Unified hyperlinks
|
||||
@@ -257,6 +260,7 @@ void FilamentGroupPopup::Init()
|
||||
SetFilamentMapMode(m_mode);
|
||||
}
|
||||
|
||||
UpdateSmartFilamentSection();
|
||||
UpdateButtonStatus();
|
||||
GUI::wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
@@ -408,4 +412,65 @@ void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
|
||||
Fit();
|
||||
}
|
||||
|
||||
void FilamentGroupPopup::MakeSmartFilamentSection(wxSizer *top_sizer, int horizontal_margin, int vertical_padding)
|
||||
{
|
||||
m_smart_filament_panel = new StaticBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_smart_filament_panel->SetCornerRadius(FromDIP(4));
|
||||
m_smart_filament_panel->SetBorderWidth(FromDIP(1));
|
||||
m_smart_filament_panel->SetBorderColor(wxColour("#CECECE"));
|
||||
m_smart_filament_panel->SetBackgroundColor(StateColor(std::pair<wxColour, int>(wxColour("#F8F8F8"), StateColor::Normal)));
|
||||
|
||||
auto *label = new Label(m_smart_filament_panel, _L("Enable smart filament assign: Assign one filament to multiple nozzles to maximize savings"));
|
||||
label->SetFont(Label::Body_12);
|
||||
label->SetForegroundColour(GreyColor);
|
||||
label->SetBackgroundColour(wxColour("#F8F8F8"));
|
||||
label->Wrap(FromDIP(240));
|
||||
|
||||
m_smart_filament_switch = new SwitchButton(m_smart_filament_panel);
|
||||
m_smart_filament_switch->Bind(wxEVT_TOGGLEBUTTON, &FilamentGroupPopup::OnSmartFilamentToggle, this);
|
||||
#ifdef __WXOSX__
|
||||
// wxEVT_TOGGLEBUTTON event not handled well by PopupWindow on MacOS
|
||||
// we bind a wxEVT_LEFT_DOWN event as a workaround
|
||||
m_smart_filament_switch->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) {
|
||||
wxCommandEvent evt(wxEVT_TOGGLEBUTTON);
|
||||
evt.SetInt(!m_smart_filament_switch->GetValue());
|
||||
m_smart_filament_switch->Command(evt);
|
||||
});
|
||||
#endif
|
||||
|
||||
auto *panel_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
panel_sizer->Add(label, 1, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(10));
|
||||
panel_sizer->Add(m_smart_filament_switch, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10));
|
||||
m_smart_filament_panel->SetSizer(panel_sizer);
|
||||
|
||||
top_sizer->Add(m_smart_filament_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, horizontal_margin);
|
||||
m_smart_filament_spacer = top_sizer->AddSpacer(vertical_padding);
|
||||
|
||||
// Hidden by default; shown in Init() when the filament track switch is ready
|
||||
m_smart_filament_panel->Show(false);
|
||||
m_smart_filament_spacer->Show(false);
|
||||
}
|
||||
|
||||
void FilamentGroupPopup::OnSmartFilamentToggle(wxCommandEvent &event)
|
||||
{
|
||||
auto &config = wxGetApp().preset_bundle->project_config;
|
||||
auto *dynamic_filament = dynamic_cast<ConfigOptionBool *>(config.option("enable_filament_dynamic_map"));
|
||||
if (dynamic_filament) { dynamic_filament->value = m_smart_filament_switch->GetValue(); }
|
||||
plater_ref->update();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void FilamentGroupPopup::UpdateSmartFilamentSection()
|
||||
{
|
||||
bool show = wxGetApp().sidebar().is_fila_switch_ready();
|
||||
m_smart_filament_panel->Show(show);
|
||||
m_smart_filament_spacer->Show(show);
|
||||
|
||||
if (show) {
|
||||
auto &config = wxGetApp().preset_bundle->project_config;
|
||||
auto *dynamic_filament = dynamic_cast<ConfigOptionBool *>(config.option("enable_filament_dynamic_map"));
|
||||
if (dynamic_filament) { m_smart_filament_switch->SetValue(dynamic_filament->value); }
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
Reference in New Issue
Block a user