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:
SoftFever
2026-07-09 18:57:05 +08:00
parent 26a0caff96
commit 0d31325df0
38 changed files with 1655 additions and 38 deletions

View File

@@ -22,6 +22,7 @@
#include "Plater.hpp"
#include "BitmapCache.hpp"
#include "BindDialog.hpp"
#include "slic3r/GUI/DeviceCore/DevFilaSwitch.h"
#include "DeviceCore/DevFilaSystem.h"
#include "DeviceCore/DevNozzleRack.h"
@@ -974,6 +975,8 @@ void AmsMapingPopup::on_left_down(wxMouseEvent &evt)
auto left = item->GetSize();
if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) {
// Orca: the external spool is un-pickable while a Filament Track Switch is installed (Apple hit-tests here).
if (m_fila_switch_installed && (item->m_ams_id == VIRTUAL_TRAY_MAIN_ID || item->m_ams_id == VIRTUAL_TRAY_DEPUTY_ID)) { return; }
if (item->m_tray_data.type == TrayType::NORMAL) {
if (!m_ext_mapping_filatype_check && (item->m_ams_id == VIRTUAL_TRAY_MAIN_ID || item->m_ams_id == VIRTUAL_TRAY_DEPUTY_ID)) {
// Do nothing
@@ -1169,6 +1172,11 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector<FilamentInfo>&
if (!obj) {return;}
m_ams_remain_detect_flag = obj->GetFilaSystem()->IsDetectRemainEnabled();
// Orca: with a Filament Track Switch installed, filament routes through the switch and the external
// spool cannot be used, so its mapping slots are rendered greyed-out and un-pickable. Inert (false)
// on any printer without a switch — GetFilaSwitch()->IsInstalled() defaults to false.
m_fila_switch_installed = obj->GetFilaSwitch()->IsInstalled();
for (auto& ams_container : m_amsmapping_container_list) {
ams_container->Destroy();
}
@@ -1546,6 +1554,20 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
#ifdef __APPLE__
m_mapping_item_list.push_back(item);
#endif
// Orca: a Filament Track Switch cannot route the external spool, so grey the ext slot out and make it
// un-pickable, with a tooltip explaining why (the click below is disabled; on_left_down also skips it).
if (m_fila_switch_installed) {
const wxString disp_name = (tray_data.type == THIRD) ? wxString("?")
: (tray_data.type == EMPTY) ? wxString("-")
: wxString(tray_data.name);
item->set_data(m_tag_material, wxColour(0xEE, 0xEE, 0xEE), disp_name, false, tray_data, true);
item->SetToolTip(_L("External spools is not supported since Filament Track Switch has been installed. If you want to use external spool, please uninstall it."));
item->Bind(wxEVT_LEFT_DOWN, [](wxMouseEvent&) { /* un-pickable while the switch is installed */ });
item->set_tray_index(_L("Ext"));
return;
}
// set button
if (tray_data.type == NORMAL) {
if (is_match_material(tray_data.filament_type)) {