From c4ded924c136e284fe70e401c2a086d65e35141d Mon Sep 17 00:00:00 2001
From: Runner PC Cavity Lab <johannes.schabbauer@tuwien.ac.at>
Date: Mon, 15 Apr 2024 11:04:32 +0200
Subject: [PATCH] Ignore limit checks in ADwinAnalogOut for PIDs

---
 ADwinProII/labscript_devices_ADwin_modules.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ADwinProII/labscript_devices_ADwin_modules.py b/ADwinProII/labscript_devices_ADwin_modules.py
index dc98dab..159a52a 100644
--- a/ADwinProII/labscript_devices_ADwin_modules.py
+++ b/ADwinProII/labscript_devices_ADwin_modules.py
@@ -187,6 +187,15 @@ class ADwinAnalogOut(AnalogOut):
         super().add_instruction(time,instruction,units)
         self.limits = limits_temp
 
+    def expand_timeseries(self,all_times,flat_all_times_len):
+        # Overwrite Output.add_instruction without limit check, becasue the value can be off-limits when this is the target value of the PID
+        # TODO / WARNING: THIS IS QUITE HACKY AND COULD LEAD TO OFF-LIMIT VALUES NOT NOTICED
+        # (the actual limits are also checked in the ADwin, so the actual output should be always within limits!)
+        limits_temp = self.limits
+        self.limits = (-10,10)
+        super().expand_timeseries(all_times,flat_all_times_len)
+        self.limits = limits_temp
+
 class ADwinAnalogIn(AnalogIn):
     """Analog Input for use with ADwin Pro II Input modules."""
     description = 'ADwin Analog Input'
-- 
GitLab