fix: improve weight processing logic and add auto-send feature for Bambu spool ID
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -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/*
|
||||||
|
18
src/main.cpp
18
src/main.cpp
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user