mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 16:32:06 +00:00
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.
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
#pragma once
|
|
#include "DevDefs.h"
|
|
#include <optional>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
namespace Slic3r
|
|
{
|
|
// Previous definitions
|
|
class MachineObject;
|
|
class DevExtder;
|
|
class DevAmsTray;
|
|
|
|
// Filament Track Switch (H2-family hardware).
|
|
// The filament blacklist consumes IsInstalled() for the `has_filament_switch`
|
|
// rule (e.g. PLA Silk). m_is_installed defaults to false and is only raised when
|
|
// the device reports the switch over MQTT (aux bit 29), so the rule stays inert on
|
|
// every printer that does not report an installed switch.
|
|
class DevFilaSwitch
|
|
{
|
|
public:
|
|
enum class CaliStatus : int
|
|
{
|
|
CALI_IDLE = 0,
|
|
CALI_STEPING = 1,
|
|
};
|
|
|
|
enum class CaliStep : int
|
|
{
|
|
CALI_IDLE = 0,
|
|
CALI_SWITCHING = 1,
|
|
CALI_SWITCH_CHECK = 2,
|
|
CALI_FILA_CHECK = 3,
|
|
CALI_FILA_TO_AMS = 4,
|
|
CALI_FILA_TO_SWITCH = 5,
|
|
CALI_FILA_BACK = 9,
|
|
CALI_FINISHED = 14,
|
|
};
|
|
|
|
enum SwitchPos : int
|
|
{
|
|
POS_IN_B = 0,
|
|
POS_IN_A = 1,
|
|
};
|
|
|
|
public:
|
|
DevFilaSwitch(MachineObject* owner);
|
|
virtual ~DevFilaSwitch() = default;
|
|
|
|
public:
|
|
bool IsInstalled() const { return m_is_installed; };
|
|
|
|
// Ready once installed and every AMS has resolved both its extruder binding and its
|
|
// switcher track position from the device. The send dialog and sidebar sync UX only
|
|
// treat the switch as usable when this is true.
|
|
bool IsReady() const;
|
|
|
|
std::optional<bool> IsInA_HasFilament() const { return m_in_a_has_filament; };
|
|
std::optional<bool> IsInB_HasFilament() const { return m_in_b_has_filament; };
|
|
|
|
std::optional<DevAmsTray> GetInA_Slot() const;
|
|
std::optional<DevAmsTray> GetInB_Slot() const;
|
|
std::optional<DevAmsSlotId> GetInA_SlotId() const { return m_in_a_slot; };
|
|
std::optional<DevAmsSlotId> GetInB_SlotId() const { return m_in_b_slot; };
|
|
|
|
std::optional<DevExtder> GetOutA_Extruder() const;
|
|
std::optional<DevExtder> GetOutB_Extruder() const;
|
|
std::optional<int> GetOutA_ExtruderId() const { return m_out_a_extruder_id; };
|
|
std::optional<int> GetOutB_ExtruderId() const { return m_out_b_extruder_id; };
|
|
|
|
CaliStatus GetCaliStatus() const { return m_cali_status; };
|
|
|
|
void Reset();
|
|
void ParseFilaSwitchInfo(const nlohmann::json& print_jj);
|
|
|
|
private:
|
|
MachineObject* m_owner;
|
|
|
|
bool m_is_installed = false;
|
|
|
|
std::optional<bool> m_in_a_has_filament;
|
|
std::optional<bool> m_in_b_has_filament;
|
|
|
|
std::optional<DevAmsSlotId> m_in_a_slot;
|
|
std::optional<DevAmsSlotId> m_in_b_slot;
|
|
|
|
std::optional<int> m_out_a_extruder_id;
|
|
std::optional<int> m_out_b_extruder_id;
|
|
|
|
CaliStatus m_cali_status = CaliStatus::CALI_IDLE;
|
|
};
|
|
};
|