From 80e0ee35f2aab7f04a2cb074e68cc4e9a703662d Mon Sep 17 00:00:00 2001
From: CPD <CPD@TUZEWSI-2LN203M.ads.mwn.de>
Date: Mon, 10 Mar 2025 13:52:08 +0100
Subject: [PATCH] Log device errors on init

---
 cpdctrl/led_control_device/impl/thorlabs_dc2200.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpdctrl/led_control_device/impl/thorlabs_dc2200.py b/cpdctrl/led_control_device/impl/thorlabs_dc2200.py
index dd0b249..83222fc 100644
--- a/cpdctrl/led_control_device/impl/thorlabs_dc2200.py
+++ b/cpdctrl/led_control_device/impl/thorlabs_dc2200.py
@@ -27,7 +27,10 @@ class DC2200(LedControlDevice):
         # turn off
         self.instr.write(f'SOURCE1:CBRightness:BRIGhtness 0')
         self.instr.write('OUTPUT1:STATE ON')
-
+        for _ in range(10):  # print max 10 errors
+            error = self.instr.query('SYSTem:ERRor?')
+            if error.startswith('+0'): break
+            log.error(f"DC2200 device error during initialization: {error}")
     def on(self):
         self.instr.write(f'SOURCE1:CBRightness:BRIGhtness 100')