From 4fc43e7db3cbf51cd8464fbb727d07217cc13a9e Mon Sep 17 00:00:00 2001 From: CPD Date: Mon, 17 Mar 2025 12:41:19 +0100 Subject: [PATCH] Set initial led value --- cpdctrl/measurement.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpdctrl/measurement.py b/cpdctrl/measurement.py index a240201..00a5d66 100644 --- a/cpdctrl/measurement.py +++ b/cpdctrl/measurement.py @@ -94,8 +94,12 @@ def measure( if flush_after == 0: flush_after = None try: i = 0 - led_val = None - led_script.start() + led_val = led_script.start() + try: + led_dev.set_level(led_val) + except Exception as e: + log.error(f"Error setting led to {led_val:03}%: {e}") + raise e t_iter_start = time.time() while True: # using while True and if, to be able to log the stop reason