filament_id v4.1: resolve retired QD_* ids in the Qidi box miss path

QidiPrinterAgent composes QD_<series>_<vendor>_<typeidx> setting ids from
device enums and previously degraded any slot whose id matched no visible
preset to generic-by-type. Plan v4.2 retires every QD_* preset id to the
succession ledger, so insert the ledger walk between the direct match and
the generic fallback: a composed QD_* id now forwards to its family's
minted OF* successor exactly like every other retired id.

Behavior-neutral until the ids are actually retired (the ledger holds no
QD_* keys yet, and live QD_* presets still match directly).

Also documents the code<->ledger lockstep on the hardcoded non-numeric-
series fallback table (QD_1_0_1/_11/_41/_50) and adds a C++ test pinning
that the succession walk is key-format agnostic.

Gates: libslic3r_tests [filament_id] 14 assertions green; libslic3r_gui
compiles.
This commit is contained in:
SoftFever
2026-08-21 18:34:20 +08:00
parent 58d1a3b093
commit 1c405f8a2c
2 changed files with 19 additions and 1 deletions
+11 -1
View File
@@ -188,7 +188,13 @@ bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url,
} else if (!setting_id.empty() && has_visible_base_preset(bundle->filaments, setting_id)) {
tray.tray_info_idx = setting_id;
} else {
tray.tray_info_idx = bundle->filaments.filament_id_by_type(tray.tray_type);
// Retired QD_* protocol ids forward to their minted successors via the shipped ledger.
const std::string successor = setting_id.empty() ? std::string()
: resolve_filament_id_succession(setting_id);
if (!successor.empty() && has_visible_base_preset(bundle->filaments, successor))
tray.tray_info_idx = successor;
else
tray.tray_info_idx = bundle->filaments.filament_id_by_type(tray.tray_type);
}
// Look up color from dictionary
@@ -324,6 +330,10 @@ void QidiPrinterAgent::parse_filament_sections(const std::string& content, std::
std::string QidiPrinterAgent::map_filament_type_to_setting_id(const std::string& filament_type)
{
// These QD_* protocol ids no longer appear on any preset: they are retired ledger keys
// that parse_box_status resolves through resolve_filament_id_succession(). Each literal
// must stay a ledger key whose chain ends at a live preset id —
// scripts/tests/test_filament_id.py parses this function and enforces that.
const std::string upper = trim_and_upper(filament_type);
if (upper == "PLA") {