From f8d344ed080894fc3844d3ba9b64f9d5d7d1684b Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Tue, 8 Mar 2022 15:37:05 +0100
Subject: [PATCH] Configure preview assemblers with new maxIdle parameter

---
 src/calng/CalibrationManager.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/calng/CalibrationManager.py b/src/calng/CalibrationManager.py
index 42136607..9fdeb9e8 100644
--- a/src/calng/CalibrationManager.py
+++ b/src/calng/CalibrationManager.py
@@ -382,6 +382,16 @@ class CalibrationManager(DeviceClientBase, Device):
         accessMode=AccessMode.INITONLY,
         assignment=Assignment.MANDATORY)
 
+    maxIdle = Double(
+        displayedName='Preview source timeout',
+        description='TrainMatcher (used for preview assemblers) has an option '
+                    '(maxIdle) to automatically ignore sources which have not '
+                    'sent data in the last maxIdle seconds (if maxIdle > 0). '
+                    'Useful in case a module fails. If missing source comes '
+                    'back, it will be matched again.',
+        defaultValue=1,
+        accessMode=AccessMode.RECONFIGURABLE)
+
     webserverApi = Node(
         WebserverApiNode,
         displayedName='Webserver API',
@@ -1295,6 +1305,7 @@ class CalibrationManager(DeviceClientBase, Device):
                 for (virtual_id, device_id)
                 in correct_device_id_by_module.items()]
             config['geometryDevice'] = self.geometryDevice.value
+            config['maxIdle'] = self.maxIdle.value
 
             if not await self._instantiate_device(
                 server, class_ids['assembler'], assembler_device_id, config
-- 
GitLab