Kaynağa Gözat

fix(printer-models): swap A1 / A1 Mini in PRINTER_MODEL_ID_MAP

  N1 and N2S were flipped relative to every other registry that names
  them - firmware_check.py (N2S -> "a1"), virtual_printer/manager.py
  (both the model map and the serial-prefix map: N2S -> 039 = A1,
  N1 -> 030 = A1 Mini), and printer_manager.py A1_MODELS all agree on
  N2S = A1, N1 = A1 Mini. Only printer_models.py had it backwards, so
  any path that resolved an A1-family printer by internal code rather
  than serial prefix would silently misclassify.

  Also fixes the matching comments in LINEAR_RAIL_MODELS - cosmetic only
  (both codes were already in the frozenset) but kept the file
  self-consistent.

  New TestA1SeriesModelIds regression test pins both directions so a
  future re-flip fails loudly.
maziggy 2 ay önce
ebeveyn
işleme
2bb69cb079

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
CHANGELOG.md


+ 4 - 4
backend/app/utils/printer_models.py

@@ -42,8 +42,8 @@ PRINTER_MODEL_ID_MAP = {
     # A1 series
     "A11": "A1",
     "A12": "A1 Mini",
-    "N1": "A1",
-    "N2S": "A1 Mini",
+    "N1": "A1 Mini",
+    "N2S": "A1",
     "A04": "A1 Mini",
     # H2 series (Office/H series)
     "O1D": "H2D",
@@ -96,8 +96,8 @@ LINEAR_RAIL_MODELS = frozenset(
         "H2C",
         "H2S",
         # Internal codes
-        "N1",  # A1
-        "N2S",  # A1 Mini
+        "N1",  # A1 Mini
+        "N2S",  # A1
         "A04",  # A1 Mini (alternate)
         "A11",  # A1
         "A12",  # A1 Mini

+ 16 - 0
backend/tests/unit/test_printer_models.py

@@ -107,6 +107,22 @@ class TestX2DModel:
         assert "N6" in STEEL_ROD_MODELS
 
 
+class TestA1SeriesModelIds:
+    """Regression guard for the A1-family internal-code → display-name map.
+
+    The serial-prefix and firmware-API key tables across the codebase agree
+    that N2S is the A1 (serial prefix 039) and N1 is the A1 Mini (serial
+    prefix 030). PRINTER_MODEL_ID_MAP had these swapped, which silently
+    misclassified A1 as A1 Mini in any path that resolved by internal code.
+    """
+
+    def test_n2s_is_a1(self):
+        assert normalize_printer_model_id("N2S") == "A1"
+
+    def test_n1_is_a1_mini(self):
+        assert normalize_printer_model_id("N1") == "A1 Mini"
+
+
 class TestDualNozzleModel:
     """is_dual_nozzle_model — the single source of truth for nozzle class,
     consumed by start_print, the K-profile routes, and the re-slice guard."""

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor