feat: adjust weight counter threshold and optimize delay in RFID scanning; include scale header in NFC module

This commit is contained in:
Manuel Weiser 2025-02-17 15:04:21 +01:00
parent f877f43d90
commit 678a286af1
2 changed files with 6 additions and 2 deletions

View File

@ -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))
{

View File

@ -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)
{