From 562f55e0dfa46a697e444624e9d3a1121b35e3ee Mon Sep 17 00:00:00 2001
From: Cyril Danilevski <cyril.danilevski@xfel.eu>
Date: Thu, 13 Mar 2025 17:35:12 +0100
Subject: [PATCH] Clarify intended behaviour when skipping iteration on stale
 data

---
 mpod.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mpod.cpp b/mpod.cpp
index dac9081..08ec1a0 100644
--- a/mpod.cpp
+++ b/mpod.cpp
@@ -260,6 +260,12 @@ void setChannelStateAndWait(const IPAddress *ipAddr, const uint16_t channel, con
 
         delay(MPOD_UPDATE_LATENCY);
         snmp.loop();
+        if (mpod.getChannel() != channel) {
+            // We have stale information, because MPOD swallowed UDP request.
+            // Skip this update check and go for next iteration, where data will be requested
+            // or request resent.
+            continue;
+        }
         loopCount += 1;
         ramping = (mpod.isRampingUp() || mpod.isRampingDown());
         if (!ramping) {
-- 
GitLab