fix: improve weight processing logic and add auto-send feature for Bambu spool ID

This commit is contained in:
2025-08-27 17:21:29 +02:00
parent 55200d31cd
commit 9e67af7343
2 changed files with 11 additions and 8 deletions

1
.gitignore vendored
View File

@@ -32,6 +32,7 @@ test/README
data/* data/*
!data/ !data/
!data/.gitkeep !data/.gitkeep
# important
html/bambu_credentials.json html/bambu_credentials.json
html/spoolman_url.json html/spoolman_url.json
_local/* _local/*

View File

@@ -225,7 +225,8 @@ void loop() {
lastWeight = weight; lastWeight = weight;
// Wenn ein Tag mit SM id erkannte wurde und der Waage Counter anspricht an SM Senden // 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 // set the current tag as processed to prevent it beeing processed again
tagProcessed = true; tagProcessed = true;
@@ -233,6 +234,11 @@ void loop() {
{ {
weightSend = 1; weightSend = 1;
// Set Bambu spool ID for auto-send if enabled
if (bambuCredentials.autosend_enable)
{
autoSetToBambuSpoolId = activeSpoolId.toInt();
}
} }
else else
{ {
@@ -241,13 +247,9 @@ void loop() {
} }
} }
if(sendOctoUpdate && spoolmanApiState == API_IDLE){ if(octoEnabled && sendOctoUpdate && spoolmanApiState == API_IDLE)
autoSetToBambuSpoolId = activeSpoolId.toInt(); {
updateSpoolOcto(autoSetToBambuSpoolId);
if(octoEnabled)
{
updateSpoolOcto(autoSetToBambuSpoolId);
}
sendOctoUpdate = false; sendOctoUpdate = false;
} }
} }