Two follow-ups from #13744 review:
1. K2 firmware payloads reference "CR-PETG" by name (per DaviBe92's
reverse-engineering work in k2-websocket-re, and a real Creality spool
seen by @swilsonnc), but the profile was missing from the Creality
filament set. Adds 10 K2-family variants:
- K2: 0.4, 0.6, 0.8 nozzles
- K2 Plus: 0.2, 0.4, 0.6, 0.8 nozzles
- K2 Pro: 0.4, 0.6, 0.8 nozzles
Profile values come from CrealityPrint v7.1.0 via @hamham999's
parallel work in OrcaSlicer/OrcaSlicer#13581. Files re-indented with
tabs and BOM stripped to match repo convention.
2. Creality HF Generic PLA and Creality HF Generic Speed PLA were missing
filament_vendor: ["Creality"] so they appeared under "General" rather
than "Creality" in the filament selector.
Reported-by: swilsonnc, DaviBe92 (CR-PETG missing)
Co-Authored-By: hamham999 <hamham999@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Root-cause + fix for the K2 Plus sparse-slot / wrong-slot-mapping bug
reported by multiple testers on Reddit and PR #13744 (DaviBe92, Psych0SW,
swilsonnc, TrainAss, Gullible-Price-4257).
DaviBe92 supplied a raw /box/getRealBoxesInfo payload from a K2 Plus
running printer FW 1.1.5.2 / CFS 1.2.2 that shows the K2 Plus uses
THREE state values for slots:
state: 0 → empty
state: 1 → loaded AND currently selected as the active spool
state: 2 → loaded but not currently selected
K2 (base) and K2 Pro firmwares — confirmed against the maintainer's
test printer — only use 0/1. Our parser had assumed the 0/1 form and
filtered with `if (state != 1) continue`, dropping every state=2 slot.
Symptoms this explains:
* DaviBe92: 3 spools loaded, only 1 displayed (the state=1 slot).
* Psych0SW / swilsonnc: 2 of 4 slots returned, "2nd shows 3rd's data"
— the parser dropped slots with state=2, leaving a sparse map that
PresetBundle::sync_ams_list then packs into consecutive UI trays.
* TrainAss / Gullible-Price-4257: "No loaded slots detected" — likely
the same root cause when zero slots happen to be state=1.
Fix: treat any non-zero state as loaded. Belt-and-braces: also skip
entries that are blanked-out (vendor and type both empty) regardless of
state, in case a future firmware uses yet another encoding for empty.
No change required for K2 / K2 Pro behaviour — they already only emit
state=0 (empty) or state=1 (loaded), and the new filter accepts both.
CI flagged ~150 K2 profile files for using space indentation; repo convention
is tab indentation. Ran the upstream-provided fixer:
python3 scripts/orca_filament_lib.py -v Creality -p filament -f --force
Mechanical normalization:
- Spaces → tabs (1 tab per indent level)
- Field ordering normalized (name + type first)
- Single-value scalar fields converted to single-element arrays where the
schema expects arrays (filament_cost, filament_density,
temperature_vitrification, filament_max_volumetric_speed)
No semantic content changes. Pre-existing issue from the original K2
profile import; touching these files in the multicolor_method strip
brought them into the validator's PR-diff scope.
Per @SoftFever review on #13752, printer-specific filament sync logic
belongs in the agent rather than in Sidebar. This consolidates the
previously-duplicated code so all CFS-specific work lives in
CrealityPrintAgent.
Changes:
- New: CrealityPrintAgent::sync_filaments_into_ams_list() — static method
that builds a CrealityPrint host from a printer_cfg, queries CFS slots,
populates PresetBundle::filament_ams_list, and triggers sync_ams_list().
GUI-free; returns a result struct (Status + counts + detail) so the
caller decides what dialog to show.
- New: nested CFSAmsListResult struct describing the five possible
outcomes (Success / NotCfsCapable / QueryFailed / EmptySlots / NoMatches).
- Removed: Sidebar::sync_filaments_from_creality_cfs() entirely (its body
is now the agent method).
- Plater.hpp loses the declaration; Plater.cpp dispatches to the agent
inline within sync_ams_list() and owns only the dialog + post-sync UI
refresh (combo updates, layout, preset selection, persistence).
Two CFS-related entry points on the agent now coexist:
- fetch_filament_info() — agent-driven path; publishes via AmsTrayData
and build_ams_payload(). Active when a MachineObject is bound (BBL
concept, not currently created for Creality LAN hosts).
- sync_filaments_into_ams_list() — explicit-pull path used today by the
Sidebar's "Sync filaments" button until the K-series MachineObject
work catches up.
No user-visible behaviour change — same end-to-end flow, the data work
just lives in the agent now.
Two data-only fixes:
#1 Strip undefined {if !multicolor_method} wrapper from filament_start_gcode on 110 K2-Plus profiles. The placeholder is a CrealityPrint-ism that survived the profile port; Orca has no such variable, so slicing failed with a hard parser error (reported on Hyper PLA by u/Gullible-Price-4257). Inner per-layer temp logic now runs unconditionally, which is the correct default.
#4 Add filament_vendor: [Creality] to 50 Creality Generic profiles missing the field. Without it the UI grouped them under Generic instead of Creality (reported by u/mharrop94).
* Added UI force-sync button and fixed bug that didn't sync in one case and caused orange highlight
* Fix sync preset race: join old thread before starting new one
---------
Co-authored-by: Mykola Nahirnyi <mnahirnyi@amcbridge.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
The matcher tiebreaker previously preferred user-edited filament
presets over system bases on a tied score. For a K2 owner who has
a custom copy of Creality Generic PLA @K2-all called eg
Creality Hyper PLA @K2 (mine), the matcher scored both that copy
and the shipped brand-specific Hyper PLA @Creality K2 0.4 nozzle
at 30, then tiebreak picked the user copy. User copies inherit
filament_id from their parent -- in this case the generic PLA
GFL99 -- so the returned id pointed at Generic PLA, not at
Hyper PLA brand-specific id (01001). PresetBundle::sync_ams_list
then resolved by id back to Creality Generic PLA @K2-all, visibly
losing the brand on every sync.
Flip the tiebreaker to prefer system over user. The shipped
brand-specific preset always wins now and sync_ams_list lands on
the right slot label.
Drop the post-sync user-override step from the sidebar path that
was layered on to compensate -- silently substituting the user
local tuning is the wrong default for an upstream-shipped
feature; users who want their local tuning on a synced slot still
get to it via the existing combo dropdown.
Import 191 brand-specific filament presets for the K2 family of
printers (K2, K2 Plus, K2 Pro), lifted from
CrealityOfficial/CrealityPrint v7.1.1 under AGPL-3.0 (compatible
with OrcaSlicer AGPL-3.0).
Brand coverage:
CR-series: CR-PLA, CR-PLA Matte, CR-PLA Fluo, CR-Silk,
CR-TPU, CR-ABS, CR-Nylon
Hyper-series: Hyper PLA, Hyper PLA-CF, Hyper ABS, Hyper PA-CF,
Hyper PA6-CF, Hyper PAHT-CF, Hyper PA612-CF,
Hyper PC, Hyper Marble, Hyper Stardust,
Hyper L-W PLA, Hyper PPA-CF
Third-party: eSUN PLA+ / PLA-HS / PLA-Matte / PLA-Silk /
PLA-CF / PLA-LW / PLA-Lite, PolySonic PLA /
PLA Pro, Panchroma PLA Matte / Satin, Soleyin
Ultra PLA, HP Ultra PLA, HP-ASA, HP-TPU
Ender PLA variants and CrealityPrint per-K2 Generic versions of
PLA, ABS, ASA, PA, PA-CF, PAHT-CF, PET, etc.
This closes the matching gap exposed by the CFS filament-sync
work. When the K2 reports spool brand Hyper PLA or CR-PLA, the
existing Creality vendor only had a generic Creality Generic PLA
@K2-all preset to fall back to, so per-brand temps / PA / cooling
tuning was lost on every sync.
Schema and naming are drop-in compatible -- CrealityPrint
references the K2/K2 Plus/K2 Pro machine names already present in
OrcaSlicer Creality vendor (Creality K2 0.4 nozzle, etc), so no
machine-side changes or compatible_printers rewrites are required.
K2 SE filaments and the PETG/PP/PPS/HIPS family are deferred. K2
SE machine profile is not yet in OrcaSlicer Creality vendor, and
the PETG/PP/PPS/HIPS family relies on fdm_filament_* base
templates that do not exist in Orca Creality vendor -- importing
those bases from CrealityPrint did not make them register as valid
parents at preset-load time. Coverage for the missing families
will land in a follow-up once the loader requirements for new
bases are understood.
Vendor version bumped to 02.03.02.75 to trigger the per-user
profile refresh on next launch. Source attribution captured in
resources/profiles/Creality/NOTICE.md.
The agent fetch_filament_info() path does not fire for Creality
K-series hosts because Sidebar::build_filament_ams_list()
short-circuits when no MachineObject is bound. MachineObject is a
BBL cloud-connected-printer concept that does not apply to LAN
Moonraker-style hosts like the K2 -- the AMS-sync icon click was a
no-op for them.
Mirror what Creality Print own slicer does (explicit Auto Mapping
button bypassing the BBL plumbing): when the user clicks the
existing AMS-sync icon and host_type=crealityprint, dispatch to a
new Sidebar::sync_filaments_from_creality_cfs() that reads the
active printer host config, confirms the printer is a CFS-capable
K-series board, queries boxsInfo over the printer WS on port 9999,
scores each loaded slot against the user filament presets and
builds a filament_ams_list entry with the matched filament_id,
colour and slot indices, then routes through
PresetBundle::sync_ams_list so the filament combo widgets get the
same rebuild as BBL printers and runs the BBL post-sync refresh
sequence (on_filament_count_change + combo update + select_preset
+ export_selections + update_dynamic_filament_list).
No new UI surface -- the existing AMS-sync icon does the right
thing per host_type. Match-and-resolve logic is hoisted out of the
agent anonymous namespace into public statics so the sidebar can
call it without duplicating scoring rules.
K-series printers (K2, K2 Plus, K2 Pro) ship with Mainsail on port
4408. Port 80 hosts only the Creality control/upload API, which
returns 404 for unknown paths and renders as a blank/404 page in
Orca Device tab.
Override CrealityPrint::get_print_host_webui() to default to
http://<host>:4408/ when the user has not explicitly set
print_host_webui, giving K-series owners a complete printer
dashboard in the Device tab out of the box.
Score visible compatible filament presets against the CFS spool
(vendor, brand_name, type) tuple to pick the right preset:
+20 preset name contains the brand_name as a substring
(eg Hyper PLA in Hyper PLA @Creality K2 0.4 nozzle)
+10 preset name contains the vendor substring (eg Creality)
Requires preset.filament_type to equal the spool base type so a
PETG preset is never auto-picked for a PLA spool. Falls back to
filaments.filament_id_by_type(base_type) when nothing scores.
Considers both base/system presets and user-derived copies -- K2
owners frequently keep tweaked copies of system presets (per-spool
PA, temps), so filtering to bases-only would skip exactly the
presets users care about most.
Subclass of MoonrakerPrinterAgent for K-series Creality printers
(K2, K2 Plus, K2 Pro) with CFS support. Registers in
NetworkAgentFactory under host_type=crealityprint. Overrides
fetch_filament_info() to defer to base when the host is not a
CFS-capable K-series board, otherwise query the boxsInfo WebSocket
on port 9999, parse the box hierarchy into CFSSlot[], and publish
each loaded slot as an AmsTrayData entry via build_ams_payload()
so they surface in Orca filament UI.
boxsInfo schema reference (verified against K2 Combo F021 firmware
v1.1.260206):
materialBoxs[].materials[] fields: id, state, vendor, type, name,
color, pressure, rfid, percent. state=1 means loaded; box.type=0
is a CFS unit, type=1 is the external spool holder (handled by
the upload dialog).
Accepted CFS boxes are renumbered sequentially since the K2 raw
box.id has gaps for the external spool holder. Model detection is
delegated to CrealityPrint::supports_multi_color_print() added in
PR #13291.
* feat: add UI feedback on http error and some logs
* spelling fix
* show error dialog only once per session
* show errors with plater notification when on developer mode
* remove return
* remove irrelevant logs
GridCellSupportEditor::DoActivate dereferenced
grid->GetSelectedBlocks().begin() without checking against end(). In
wxWidgets 3.1.5 that range always contained at least one block; in 3.3.2
it is empty after the user deselects, and the dereference crashes inside
wxGridBlockCoords::GetLeftCol().
Fall back to the (row, col) that triggered activation when the selection
is empty, so the existing single-cell branch handles it. While here,
drop a dead local_table cast that was never read.
Fix macOS orcaslicer:// deep links after wxWidgets 3.3.2 upgrade
Install an OrcaSlicer-owned kAEGetURL Apple Event handler from
on_init_inner(). The wxWidgets 3.3.2 handler registered in
applicationWillFinishLaunching: stopped delivering URL events to
GUI_App::MacOpenURL on macOS (#13119), so links from Printables /
Thingiverse opened a blank project instead of importing the model.
Registering our own handler late in startup is last-writer-wins on
NSAppleEventManager and routes back to the existing MacOpenURL ->
start_download path, restoring the pre-upgrade behavior without
touching wxWidgets.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Use glBlendFuncSeparate in GLTexture::render_sub_texture so destination
alpha stays at 1.0. The Wayland compositor honors framebuffer alpha for window compositing; the previous straight-alpha blend reduced dst alpha
at anti-aliased icon edges, making them semi-transparent against the
desktop. RGB blending is unchanged, so X11/Windows/macOS are unaffected.
Delay opening the object-list filament dropdown on wxGTK until the editor
window is mapped, avoiding popup creation without a valid native toplevel.
Also set the GTK transient parent for dropdown popups created from data-view
cell editors.
# Description
Currently, there is some suspicious behavior going on with the logout
flow, adding some logs to potentially catch any unwanted logouts or
unintentional behaviors.
[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
When the spool holder is selected for printing, use the opGcodeFile
command with enableSelfTest instead of colorMatch + multiColorPrint.
This matches the protocol used by CrealityPrint desktop for spool
holder prints.
- Detect spool holder mode: any colorMatch entry with box_id 0
- Spool holder: send opGcodeFile + enableSelfTest (single command)
- CFS: send colorMatch + multiColorPrint (existing behavior)
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Show the spool holder (external filament roll) as a selectable option
in the K2 Plus filament mapping dialog. Previously only CFS slots were
shown because the box state filter excluded the spool holder.
- Only skip inactive CFS boxes (type 0, state != 1); spool holder
(type 1) is always available
- Label spool holder slots as "Ext - {type}" in the dropdown
- Auto-match priority is now:
1. CFS exact (type + color)
2. CFS type-only
3. Ext exact (type + color)
4. Ext type-only
5. Positional default
- When Ext is selected (by user or auto-match), disable other combos
since firmware does not support mixing CFS and spool holder
Signed-off-by: Igor Mammedov <niallain@gmail.com>
When the filament mapping dialog opens, automatically select the best
matching CFS slot for each gcode filament by comparing color and type.
Falls back to positional index if no exact match is found.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Query CFS material slots and show colored dropdowns to map gcode
filaments to physical printer slots. Color mapping is passed through
extended_info as colorMatch entries for the multi-color print protocol.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
v4:
- Use gcode tool index (T1A, T1B, ...) as colorMatch id instead of
CFS slot tool_id — firmware expects the gcode filament identifier,
not the destination slot
Add enableSelfTest checkbox to CrealityPrintHostSendDialog that
persists across sessions via AppConfig. The checkbox state is
passed to the upload via extendedInfo().
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add model_name() to map firmware model codes (F008, F012, F021)
to human-readable names (K2 Plus, K2 Pro, K2). Update the send
dialog init() to detect multi-color support and show a group box
with the printer name.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add CrealityPrintHostSendDialog scaffolding: an empty dialog class
that inherits from PrintHostSendDialog, and Plater wiring to use
it when the host type is CrealityPrint.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
For supported models, start_print() sends colorMatch (filament-to-slot
mapping) followed by multiColorPrint (with optional calibration via
enableSelfTest) instead of the legacy opGcodeFile command. The dialog
passes color mapping and calibration settings through extended_info.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
v4:
- Skip "path" form field in multipart upload for multi-color printers
(extra field breaks K2 Plus firmware parser)
- Use fire-and-forget ws.write() for colorMatch and multiColorPrint
instead of ws_send_and_read() (printer sends response asynchronously)
Add query_boxes_info() to discover loaded materials in the CFS
(Creality Filament System) via websocket. Returns the boxsInfo
JSON with slot details (type, color, vendor, temperature range).
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add a reusable websocket helper that sends a JSON command and loops
reads until finding a response containing the expected key. This
handles the printer's unsolicited status messages that arrive on
connect before the actual response. Returns empty string on timeout
instead of throwing.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Consolidate websocket connection setup into a reusable helper.
Migrate from tcp::socket to beast::tcp_stream for timeout support.
Set SO_RCVTIMEO read timeout (3s) and connect timeout (5s).
Refactor query_boxes_info() and start_print() to use ws_connect().
Signed-off-by: Igor Mammedov <niallain@gmail.com>