diff --git a/src/main.cpp b/src/main.cpp index d50fb22..e91448d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -128,6 +128,7 @@ void loop() { weightSend = 0; } } + // reset weight counter after writing tag if (currentMillis - lastWeightReadTime >= weightReadInterval && hasReadRfidTag > 1) { @@ -137,7 +138,7 @@ void loop() { lastWeight = weight; // Wenn ein Tag mit SM id erkannte wurde und der Waage Counter anspricht an SM Senden - if (spoolId != "" && weigthCouterToApi > 5 && weightSend == 0 && hasReadRfidTag == 1) { + if (spoolId != "" && weigthCouterToApi > 3 && weightSend == 0 && hasReadRfidTag == 1) { oledShowIcon("loading"); if (updateSpoolWeight(spoolId, weight)) { diff --git a/src/nfc.cpp b/src/nfc.cpp index 2aed149..a0910e1 100644 --- a/src/nfc.cpp +++ b/src/nfc.cpp @@ -6,6 +6,7 @@ #include "website.h" #include "api.h" #include "esp_task_wdt.h" +#include "scale.h" //Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS); Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET); @@ -283,6 +284,7 @@ void writeJsonToTag(void *parameter) { // aktualisieren der Website wenn sich der Status ändert sendNfcData(nullptr); pauseBambuMqttTask = false; + if (updateSpoolTagId(uidString, payload)) { uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID uint8_t uidLength; @@ -291,6 +293,7 @@ void writeJsonToTag(void *parameter) { yield(); } } + vTaskResume(RfidReaderTask); vTaskDelay(500 / portTICK_PERIOD_MS); } @@ -360,7 +363,7 @@ void scanRfidTask(void * parameter) { hasReadRfidTag = 6; oledShowIcon("transfer"); - vTaskDelay(1000 / portTICK_PERIOD_MS); + vTaskDelay(500 / portTICK_PERIOD_MS); if (uidLength == 7) {