Browse Source

Fix H2C firmware update downloading wrong (H2D) firmware (#311)

H2C was mapped to the "h2d" firmware API key, causing it to check
the H2D firmware page and offer H2D firmware for download. H2C has
its own separate firmware track (01.01.x.x vs H2D's 01.02.x.x).

Changed H2C to use its own "h2c" API key and added the reverse
mapping. Also added missing H2C (O1C) and H2S (O1S) entries to
the printer model ID and 3MF model name maps.
maziggy 3 months ago
parent
commit
ae63ec8a91
3 changed files with 8 additions and 2 deletions
  1. 1 0
      CHANGELOG.md
  2. 2 1
      backend/app/services/firmware_check.py
  3. 5 1
      backend/app/utils/printer_models.py

+ 1 - 0
CHANGELOG.md

@@ -22,6 +22,7 @@ All notable changes to Bambuddy will be documented in this file.
 
 ### Fixed
 - **H2C Nozzle Rack Shows Wrong Nozzles** ([#300](https://github.com/maziggy/bambuddy/issues/300)) — The nozzle rack included L/R nozzle heads (IDs 0, 1) alongside the actual rack slots (IDs 16–21), causing the mounted nozzle to appear docked and the last rack position (e.g., 0.6mm) to be cut off. Backend now filters to rack-only entries (id >= 2) and sorts by ID for consistent ordering.
+- **H2C Firmware Update Downloads Wrong Firmware** ([#311](https://github.com/maziggy/bambuddy/issues/311)) — H2C printers were mapped to the H2D firmware API key (`h2d`), causing firmware checks to offer H2D firmware instead of H2C firmware. H2C has its own firmware track (01.01.x.x vs H2D's 01.02.x.x). Added separate `h2c` API key mapping. Also added missing H2C/H2S entries to printer model ID and 3MF model maps.
 - **Sidebar Links Custom Icons Have Inverted Colors** ([#308](https://github.com/maziggy/bambuddy/issues/308)) — Custom uploaded icons in sidebar links had their colors inverted in dark mode due to a CSS `invert()` filter. The filter was intended for monochrome preset icons but was incorrectly applied to user-uploaded images (e.g., full-color logos). Removed the invert filter from custom icon rendering in the sidebar and the add/edit link modal.
 - **Virtual Printer FTP Transfer Fails With Connection Reset** ([#58](https://github.com/maziggy/bambuddy/issues/58)) — Large 3MF uploads to the virtual printer intermittently failed with `[Errno 104] Connection reset by peer` while the small verify_job always succeeded. The `_handle_data_connection` callback returned immediately, allowing the asyncio server-handler task to complete while the data connection was still in active use. The passive port listener also stayed open during transfers, risking duplicate data connections. Fixed by keeping the callback alive until the transfer completes (`_transfer_done` event), closing the passive listener after accepting the connection, and rejecting duplicate data connections. Also added a 5-second drain timeout to MQTT status pushes to prevent blocking when the slicer is busy uploading.
 - **Camera Stop 401 When Auth Enabled** — Camera stop requests (`sendBeacon`) failed with 401 Unauthorized when authentication was enabled because `sendBeacon` cannot send auth headers. Replaced with `fetch` + `keepalive: true` which supports Authorization headers while remaining reliable during page unload.

+ 2 - 1
backend/app/services/firmware_check.py

@@ -38,7 +38,7 @@ MODEL_TO_API_KEY = {
     "A1-Mini": "a1-mini",
     "A1mini": "a1-mini",
     "H2D": "h2d",
-    "H2C": "h2d",  # H2C uses same firmware as H2D
+    "H2C": "h2c",
     "H2S": "h2s",
     "P2S": "p2s",
     "X1E": "x1e",
@@ -54,6 +54,7 @@ API_KEY_TO_DEV_MODEL = {
     "a1": "N2S",
     "a1-mini": "N1",
     "h2d": "O1D",
+    "h2c": "O1C",
     "h2s": "O1S",
     "p2s": "N7",
     "x1e": "C13",

+ 5 - 1
backend/app/utils/printer_models.py

@@ -17,6 +17,8 @@ PRINTER_MODEL_MAP = {
     "Bambu Lab A1 mini": "A1 Mini",
     "Bambu Lab H2D": "H2D",
     "Bambu Lab H2D Pro": "H2D Pro",
+    "Bambu Lab H2C": "H2C",
+    "Bambu Lab H2S": "H2S",
 }
 
 # Map from printer_model_id (internal codes in slice_info.config) to short names
@@ -37,10 +39,12 @@ PRINTER_MODEL_ID_MAP = {
     "N1": "A1",
     "N2S": "A1 Mini",
     "A04": "A1 Mini",
-    # H2D series (Office/H series)
+    # H2 series (Office/H series)
     "O1D": "H2D",
     "O1E": "H2D Pro",  # Some devices report O1E
     "O2D": "H2D Pro",  # Some devices report O2D
+    "O1C": "H2C",
+    "O1S": "H2S",
 }