From eb2be556a4559579c2eaf0ccc7165c45d5d2bd82 Mon Sep 17 00:00:00 2001
From: Cyril Danilevski <cyril.danilevski@xfel.eu>
Date: Fri, 14 Feb 2025 18:53:22 +0100
Subject: [PATCH] Check target voltage and target current on channel poll

---
 mpod.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mpod.cpp b/mpod.cpp
index 61940bb..86030b7 100644
--- a/mpod.cpp
+++ b/mpod.cpp
@@ -23,6 +23,10 @@ SNMP::Message *MPOD::read(uint16_t channel) {
     snmp_cmd += channel;
     message->add(snmp_cmd.c_str());
 
+    snmp_cmd = OID::NAMES[OID::OUTPUTVOLTAGE];
+    snmp_cmd += channel;
+    message->add(snmp_cmd.c_str());
+
     snmp_cmd = OID::NAMES[OID::OUTPUTMEASUREMENTSENSEVOLTAGE];
     snmp_cmd += channel;
     message->add(snmp_cmd.c_str());
@@ -31,6 +35,10 @@ SNMP::Message *MPOD::read(uint16_t channel) {
     snmp_cmd += channel;
     message->add(snmp_cmd.c_str());
 
+    snmp_cmd = OID::NAMES[OID::OUTPUTCURRENT];
+    snmp_cmd += channel;
+    message->add(snmp_cmd.c_str());
+
     return message;
 }
 
@@ -202,9 +210,6 @@ void initializeSNMP() {
     Serial.println("SNMP Server Started");
 }
 
-/* setChannelAndWait
- * Set a channel's parameters and wait until it's settled.
- */
 void setChannelStateAndWait(const IPAddress *ipAddr, const uint16_t channel, const uint8_t output) {
     // Send set command
     SNMP::Message *snmp_msg = mpod.setChannelState(channel, output);
@@ -244,6 +249,5 @@ void setChannelVoltageAndWait(const IPAddress *ipAddr, const uint16_t channel,
         delete snmp_msg;
         delay(MPOD_UPDATE_LATENCY);
         snmp.loop();
-    } while (mpod.isRampingDown() ||
-             mpod.isRampingUp());  // TODO check applied voltage close to target voltage
+    } while (mpod.isRampingDown() || mpod.isRampingUp());
 }
-- 
GitLab