diff --git a/.gitignore b/.gitignore index b9774e9..a6e7ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ test/README data/* !data/ !data/.gitkeep +# important html/bambu_credentials.json html/spoolman_url.json _local/* diff --git a/src/main.cpp b/src/main.cpp index 2b75b6c..9c757c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -225,7 +225,8 @@ void loop() { lastWeight = weight; // Wenn ein Tag mit SM id erkannte wurde und der Waage Counter anspricht an SM Senden - if (activeSpoolId != "" && weigthCouterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_READ_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE) { + if (activeSpoolId != "" && weigthCouterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_READ_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE) + { // set the current tag as processed to prevent it beeing processed again tagProcessed = true; @@ -233,6 +234,11 @@ void loop() { { weightSend = 1; + // Set Bambu spool ID for auto-send if enabled + if (bambuCredentials.autosend_enable) + { + autoSetToBambuSpoolId = activeSpoolId.toInt(); + } } else { @@ -241,13 +247,9 @@ void loop() { } } - if(sendOctoUpdate && spoolmanApiState == API_IDLE){ - autoSetToBambuSpoolId = activeSpoolId.toInt(); - - if(octoEnabled) - { - updateSpoolOcto(autoSetToBambuSpoolId); - } + if(octoEnabled && sendOctoUpdate && spoolmanApiState == API_IDLE) + { + updateSpoolOcto(autoSetToBambuSpoolId); sendOctoUpdate = false; } }