diff --git a/html/rfid.js b/html/rfid.js index 75eb337..1a975c4 100644 --- a/html/rfid.js +++ b/html/rfid.js @@ -405,7 +405,7 @@ function handleSpoolIn(amsId, trayId) { minTemp = selectedSpool.filament.nozzle_temperature[0]; maxTemp = selectedSpool.filament.nozzle_temperature[1]; } - + // Erstelle Payload const payload = { type: 'setBambuSpool', @@ -416,7 +416,8 @@ function handleSpoolIn(amsId, trayId) { nozzle_temp_min: parseInt(minTemp), nozzle_temp_max: parseInt(maxTemp), type: selectedSpool.filament.material, - brand: selectedSpool.filament.vendor.name + brand: selectedSpool.filament.vendor.name, + tray_info_idx: selectedSpool.filament.extra.bambu_idx.replace(/['"]+/g, '').trim() } }; diff --git a/src/bambu.cpp b/src/bambu.cpp index 3cf345e..afa8fca 100644 --- a/src/bambu.cpp +++ b/src/bambu.cpp @@ -174,6 +174,7 @@ bool setBambuSpool(String payload) { */ Serial.println("Setting spool"); + Serial.println(payload); // Parse the JSON JsonDocument doc; @@ -192,7 +193,8 @@ bool setBambuSpool(String payload) { int maxTemp = doc["nozzle_temp_max"]; String type = doc["type"].as(); String brand = doc["brand"].as(); - String tray_info_idx = (brand != "" && type != "") ? findFilamentIdx(brand, type) : ""; + String tray_info_idx = doc["tray_info_idx"].as(); + if (tray_info_idx == "") tray_info_idx = (brand != "" && type != "") ? findFilamentIdx(brand, type) : ""; doc.clear(); @@ -441,6 +443,8 @@ void mqtt_loop(void * parameter) { vTaskDelay(100); } client.loop(); + yield(); + vTaskDelay(100); } }