From a1e6b1c7fff680f637fdbd2f3031cc36943c6520 Mon Sep 17 00:00:00 2001
From: MALFREYT <alexandre.malfreyt@synchrotron-soleil.fr>
Date: Fri, 21 Feb 2025 17:01:31 +0100
Subject: [PATCH] feat: write memorized value at init if
 writeMemorizedValuesAtInit is true (instead of just set_channel)

---
 src/SingleShotAO.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp
index 56cb44d..dd92d5a 100755
--- a/src/SingleShotAO.cpp
+++ b/src/SingleShotAO.cpp
@@ -537,8 +537,10 @@ void SingleShotAO::init_device()
 		// Get and set memorized values for speed, initial and channel
 		applyMemorizedAttr(kSPEED, &SingleShotAOManager::set_speed);
 		applyMemorizedAttr(kINITIAL, &SingleShotAOManager::set_initial); 
-		applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::set_channel);
-		// TODO: add a property to call write_channel instead of set_channel (false by default)
+		if (writeMemorizedValuesAtInit)
+			applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::write_channel);
+		else
+			applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::set_channel);
     }
 
 	//- GO for task
-- 
GitLab