From fd7b4c25b31f1d5cf090ad7f5d82d9b867e9b743 Mon Sep 17 00:00:00 2001 From: Jan Philipp Ecker Date: Tue, 22 Jul 2025 10:47:47 +0200 Subject: [PATCH] Fixes some issues with the new location tags Fixes an issue where the location dropdown is not visible if the Bambu integration is active. Adds support for the "NFC-Tag" view on the webpage, it now also shows info about the location tags. Revers a change that was not supposed to go into main where the amount of data written to the spool tag is reduced to only the sm_id. --- html/rfid.js | 38 +++++++++++++++++++++++++++++--------- html/rfid_bambu.html | 12 ++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/html/rfid.js b/html/rfid.js index 6bdcea2..d3a54a5 100644 --- a/html/rfid.js +++ b/html/rfid.js @@ -555,7 +555,10 @@ function updateNfcData(data) { } // HTML für die Datenanzeige erstellen - let html = ` + let html = ""; + + if(data.sm_id){ + html = `

Brand: ${data.brand || 'N/A'}

Type: ${data.type || 'N/A'} ${data.color_hex ? `` : ''}

- `; + `; - // Spoolman ID anzeigen - html += `

Spoolman ID: ${data.sm_id || 'No Spoolman ID'}

`; + // Spoolman ID anzeigen + html += `

Spoolman ID: ${data.sm_id || 'No Spoolman ID'}

`; + } + else if(data.location) + { + html = ` +
+

Location: ${data.location || 'N/A'}

+ `; + } + else + { + html = ` +
+

Unknown tag

+ `; + } + + // Nur wenn eine sm_id vorhanden ist, aktualisiere die Dropdowns if (data.sm_id) { @@ -626,11 +646,11 @@ function writeNfcTag() { // Erstelle das NFC-Datenpaket mit korrekten Datentypen const nfcData = { - //color_hex: selectedSpool.filament.color_hex || "FFFFFF", - //type: selectedSpool.filament.material, - //min_temp: minTemp, - //max_temp: maxTemp, - //brand: selectedSpool.filament.vendor.name, + color_hex: selectedSpool.filament.color_hex || "FFFFFF", + type: selectedSpool.filament.material, + min_temp: minTemp, + max_temp: maxTemp, + brand: selectedSpool.filament.vendor.name, sm_id: String(selectedSpool.id) // Konvertiere zu String }; diff --git a/html/rfid_bambu.html b/html/rfid_bambu.html index b3b2527..9fc3210 100644 --- a/html/rfid_bambu.html +++ b/html/rfid_bambu.html @@ -139,6 +139,18 @@

+ +
+

Spoolman Locations

+ +
+ +
+

+ +