From 5f0b7a500525290dc9a9f96aac968723e635aaa9 Mon Sep 17 00:00:00 2001
From: Runner PC Cavity Lab <johannes.schabbauer@tuwien.ac.at>
Date: Wed, 15 Jan 2025 14:10:39 +0100
Subject: [PATCH] ADwin: Bugfix for PID error check (we I set output at end, I
 still got the error)

---
 ADwinProII/labscript_devices_ADwin_modules.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ADwinProII/labscript_devices_ADwin_modules.py b/ADwinProII/labscript_devices_ADwin_modules.py
index 48ff106..b8ac520 100644
--- a/ADwinProII/labscript_devices_ADwin_modules.py
+++ b/ADwinProII/labscript_devices_ADwin_modules.py
@@ -379,7 +379,7 @@ class ADwinAO8(_ADwinCard):
                     #  - at least once in the end the output is (re)set, otherwise the get_final_values() in the Worker is wrong,
                     #  - don't try to also set the target value at the same time, as this would overwrite the target in the ADwin with the PID output.
                     if PID[t]["start"]=="last":
-                        if i_out+1==len(output.all_times):
+                        if i_out+1==len(output.all_times) and output.raw_output[i_out]==100_000:
                             raise LabscriptError(f"{output.name}: You must set the output at the end after turning off PID with 'last'.")
                         elif output.all_times[i_out] == t:
                             raise LabscriptError(f"{output.name}: Don't turn off PID with persitent value ('last') and also set new value.")
-- 
GitLab