Skip to content

fix(ams): preserve connected device filament identity#178

Open
phantom-man wants to merge 1 commit into
QIDITECH:mainfrom
phantom-man:fix/connected-ams-filament-sync
Open

fix(ams): preserve connected device filament identity#178
phantom-man wants to merge 1 commit into
QIDITECH:mainfrom
phantom-man:fix/connected-ams-filament-sync

Conversation

@phantom-man

Copy link
Copy Markdown

Connected AMS slots were being reduced back to legacy QD_* ids and a binary vendor model after reading live printer state. That worked for the old stock catalog but broke connected-device material identity for expanded and custom filament entries.

This change keeps the connected-device AMS path aligned with the actual live printer data and the expanded official filament catalog.

What changed:

  • resolve connected AMS slot materials against the real local preset catalog by name, type, and vendor before falling back to the legacy QD_* id formula
  • fix the device-page tray classification so only exact QIDI vendor is treated as QIDI
  • restore the AMS material picker logic so it uses the current printer and nozzle context instead of the stale hardcoded path
  • sync the bundled officiall_filas_list.cfg to the same verified full catalog used on the live printer and in the Q2 repo update

Why:

  • the live printer fix only solves the source catalog side
  • QIDIStudio still needed to stop collapsing connected AMS materials back into the old official-id model on the client side

Validation:

  • verified the live printer first with the expanded printer-side file before preparing this repo change
  • editor diagnostics report no errors in the modified AMS files

Connected AMS slots were being collapsed back into legacy QD_* ids and a
binary Generic/QIDI vendor model after reading live printer state.

Resolve live slot materials against the real preset catalog first, keep the
legacy id as fallback only, restore the current AMS material picker logic,
and sync the bundled official filament list to the verified full catalog.
Copilot AI review requested due to automatic review settings April 9, 2026 20:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to preserve the full connected-device AMS filament identity (name/type/vendor-based) instead of collapsing connected AMS slots back into legacy QD_* ids and a binary vendor model, aligning QIDIStudio’s connected AMS behavior with live printer state and the expanded filament catalog.

Changes:

  • Adds connected-filament normalization and preset-catalog resolution helpers (with legacy-id fallback planned).
  • Tightens device-page tray classification so only exact "QIDI" vendor is treated as QIDI.
  • Updates AMS material picker filtering to use current printer/nozzle context, and syncs the bundled filament catalog to an expanded list.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/slic3r/GUI/QDSDeviceManager.cpp Adds helper functions intended to resolve connected AMS filament ids against the preset catalog.
src/slic3r/GUI/PrinterWebView.cpp Adjusts tray vendor classification to treat only exact "QIDI" as QIDI.
src/slic3r/GUI/AMSMaterialsSetting.cpp Reworks filament list filtering using printer/nozzle context; adjusts PA-profile visibility logic.
resources/profiles/officiall_filas_list.cfg Replaces bundled filament list with a much larger/expanded catalog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1041 to 1042
auto & filaments = preset_bundle->filaments;
if (preset_bundle) {

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preset_bundle is dereferenced before the null-check (auto& filaments = preset_bundle->filaments;). If wxGetApp().preset_bundle can ever be null, this is immediate undefined behavior. Move the filaments reference initialization inside the if (preset_bundle) block or early-return when preset_bundle == nullptr.

Suggested change
auto & filaments = preset_bundle->filaments;
if (preset_bundle) {
if (preset_bundle) {
auto & filaments = preset_bundle->filaments;

Copilot uses AI. Check for mistakes.
}

if (obj->GetCalib()->IsVersionInited()) {
if (obj->cali_version >= 0) {

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MachineObject does not have a cali_version member (see DeviceManager.hpp), so this will not compile. Keep using obj->GetCalib()->IsVersionInited() (or add a proper accessor on MachineObject/DevCalib) rather than accessing a non-existent field.

Suggested change
if (obj->cali_version >= 0) {
if (obj->GetCalib() && obj->GetCalib()->IsVersionInited()) {

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +52
std::string resolve_connected_filament_id(const QDSDevice::Filament& filament)
{
auto* preset_bundle = wxGetApp().preset_bundle;
if (preset_bundle == nullptr)
return {};

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new connected-filament resolution helpers are currently not used anywhere in this file, so connected AMS slots will still be collapsed to the legacy QD_* ids by the existing logic later in the file. Please wire this resolver into the slot->filament_id computation (with a legacy fallback) so the PR actually preserves the live filament identity, and to avoid -Wunused-function build failures under Werror.

Copilot uses AI. Check for mistakes.
Comment on lines +2409 to +2413
[fila302]
filament = ZIRO Carbon Fiber PLA Filament
min_temp = 210
max_temp = 250
box_min_temp = 0

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catalog now includes entries up to [fila302] (and colordict indices up to 302). The C++ loader currently hard-sizes the filament tables to 100 entries (e.g., m_general_filamentConfig.resize(100)), which will cause out-of-bounds writes/memory corruption when reading this updated file. The loader needs to size dynamically based on the max index in the file (or otherwise support 300+ entries) before this catalog expansion can be safely shipped.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants