Add Spoolman card_uid lookup, Snapmaker U1 CARD_UID API, and wifi_ssid/wifi_pass commands#5
Conversation
…s commands
Spoolman card_uid lookup (NetworkManager.cpp, main.cpp):
- fetchSpoolmanByExternalId now fetches /api/v1/spool?allow_archived=true
in a single request and searches all spools in one pass - no extra HTTP call
- Checks spool.extra.card_uids first (comma-separated, JSON-encoded strings)
against data.hardware_uid; normalises both sides (uppercase, strip
colons/hyphens/spaces/quotes/0x prefix) before comparing
- Falls back to lot_nr match if no card_uid hit is found
- fetchSpoolmanData gate widened: hardware_uid OR lot_nr triggers the lookup
- main.cpp Spoolman fetch condition extended to also fire on hardware_uid
Snapmaker U1 CARD_UID payload (NetworkManager.cpp):
- When hardware_uid is valid, sends {channel:N,info:{CARD_UID:[...]}}
instead of vendor/material/colour data; U1 Extended Firmware resolves the
spool from Spoolman itself via CARD_UID
- UID normalisation: strips 0x, colons, hyphens, spaces, quotes; uppercases;
splits into decimal byte array
- Validation: non-empty, even hex length, only [0-9A-F] chars; logs error
and skips request if invalid
- Falls back to existing VENDOR/MAIN_TYPE/RGB_1/... payload when no valid
UID is present (backwards compatible)
- Serial debug logs show raw UID, normalised UID, byte array, HTTP response
Wi-Fi SSID/password with spaces (SerialTerminal.cpp):
- New commands: set wifi_ssid <ssid> and set wifi_pass <password>
accept the full remainder of the line, so SSIDs or passwords containing
spaces work without quoting
- Existing set wifi <ssid> <password> unchanged (backwards compatible)
- get config outputs set wifi_ssid / set wifi_pass when SSID contains spaces
- help text updated to document all three variants
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added static labelHardwareUid member to DisplayUI - create_ext_row for Card UID in buildExtendedInfoScreen, placed after Lot Nr - set_field for hardware_uid in showExtendedInfoScreen - Row is hidden automatically when no UID is present Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Hi! erstmal: Dankeschön! Allerdings möchte ich den PR so nicht mergen.
Das hab ich übernommen bzw re-implementiert. Danke für den Hinweis!
Gemini hält Claudes Lösungen für fragwürdig 😜 Grüße, |
Summary
1. Spoolman
card_uidslookup (NetworkManager.cpp,main.cpp)fetchSpoolmanByExternalIdfetches/api/v1/spool?allow_archived=truein a single HTTP request and iterates all spools in one passspool.extra.card_uids(Spoolman JSON-encoded string, comma-separated) againstdata.hardware_uid— normalises both sides (uppercase, strip colons/hyphens/spaces/quotes/0xprefix) before comparinglot_nrmatch if nocard_uidhit is foundfetchSpoolmanDatagate widened:hardware_uidorlot_nrnow triggers the lookup (previously requiredhardware_uid)main.cppSpoolman fetch condition extended to also fire whenhardware_uidis set2. Snapmaker U1
CARD_UIDpayload (NetworkManager.cpp)hardware_uidis valid, sends{"channel":N,"info":{"CARD_UID":[86,132,77,206]}}instead of vendor/material/colour fields — the U1 Extended Firmware resolves the spool from Spoolman automatically viaCARD_UID0x, colons, hyphens, spaces, quotes; uppercases; splits into decimal byte array (e.g.56:84:4D:CE→[86,132,77,206])[0-9A-F]— logs error and skips request if invalidVENDOR/MAIN_TYPE/RGB_1/... payload when no valid UID is present3. Wi-Fi SSID/password with spaces (
SerialTerminal.cpp)set wifi_ssid <ssid>andset wifi_pass <password>accept the full remainder of the line, so SSIDs or passwords containing spaces work without quotingset wifi <ssid> <password>is unchanged (backwards compatible)get configoutputsset wifi_ssid/set wifi_passwhen the stored SSID contains spaces, so the output is always directly re-enterablehelptext updated to document all three variantsTest plan
pio test -e desktop— 18/18 tests pass (verified)pio run -e pn5180— builds and flashes successfully (verified)spool.extra.card_uidsin Spoolman — spool resolves correctlyCARD_UIDbyte array, U1 accepts requestset wifi_ssid My Network Name+set wifi_pass secret— connects successfullyset wifi simpleSSID password— still works as before🤖 Generated with Claude Code