From 29e8b09c5ac55ace664fb8ab6bcf7030d0f790a5 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 21 Feb 2026 16:55:40 +0100 Subject: [PATCH] fix: ensure weight is only sent for valid spool tags in loop --- src/main.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 272e108..dc2711e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -233,14 +233,21 @@ void loop() { if (nfcReaderState == NFC_WRITE_SUCCESS && tagProcessed == false) { tagProcessed = true; - int sId = activeSpoolId.toInt(); - sendWeightAsync(sId, activeTagUuid, weight); - weightSend = 1; - Serial.println("Weight queued for FilaMan after tag write"); - // Feedback to user - pauseMainTask = 1; - oledShowProgressBar(3, 4, "Tag written", "Sending..."); + // Only send weight if a valid spoolId exists (spool tag, not location tag) + if (activeSpoolId.length() > 0 && activeSpoolId != "0") { + int sId = activeSpoolId.toInt(); + sendWeightAsync(sId, activeTagUuid, weight); + weightSend = 1; + Serial.println("Weight queued for FilaMan after spool tag write"); + + // Feedback to user + pauseMainTask = 1; + oledShowProgressBar(3, 4, "Tag written", "Sending..."); + } else { + // Location tag written - no weight to send + Serial.println("Location tag written successfully - no weight send needed"); + } } }