fix: enhance Bambu spool handling by adding tray info index and improving logging
This commit is contained in:
parent
0379c4c45f
commit
9ace9f0567
@ -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()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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>();
|
||||
String brand = doc["brand"].as<String>();
|
||||
String tray_info_idx = (brand != "" && type != "") ? findFilamentIdx(brand, type) : "";
|
||||
String tray_info_idx = doc["tray_info_idx"].as<String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user