From 1be6b9cc0bbd611b8a2e6303bde692664f115508 Mon Sep 17 00:00:00 2001 From: msilvafe Date: Thu, 11 Sep 2025 17:45:21 -0400 Subject: [PATCH 1/2] Check if sensor list is changing and adjust. --- socs/agents/smurf_crate_monitor/agent.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/socs/agents/smurf_crate_monitor/agent.py b/socs/agents/smurf_crate_monitor/agent.py index 44d8dd6a6..8ec277767 100644 --- a/socs/agents/smurf_crate_monitor/agent.py +++ b/socs/agents/smurf_crate_monitor/agent.py @@ -243,6 +243,7 @@ def acq(self, session, params=None): ipmbs, sensids, chan_names = self._init_data_stream(shm_addr=shm_addr) self.log.info('Got sensor names') self.take_data = True + last_data_dict = None while self.take_data: for _ in range(30): if not self.take_data: @@ -253,6 +254,16 @@ def acq(self, session, params=None): sensids=sensids, chan_names=chan_names, crate_id=self.crate_id) + if not last_data_dict is None: + # Check if returned keys has changed if so get new sensor names + if datadict.keys() != last_data_dict.keys(): + ipmbs, sensids, chan_names = self._init_data_stream(shm_addr=shm_addr) + datadict = get_data_dict(shm_addr=self.shm_addr, + ipmbs=ipmbs, + sensids=sensids, + chan_names=chan_names, + crate_id=self.crate_id) + last_data_dict = datadict data = { 'timestamp': time.time(), 'block_name': f'smurf_{self.crate_id}', From 6cade73e5d6113202fada4d3746873a21db86608 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 21:49:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- socs/agents/smurf_crate_monitor/agent.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/socs/agents/smurf_crate_monitor/agent.py b/socs/agents/smurf_crate_monitor/agent.py index 8ec277767..5b0e7998a 100644 --- a/socs/agents/smurf_crate_monitor/agent.py +++ b/socs/agents/smurf_crate_monitor/agent.py @@ -254,15 +254,15 @@ def acq(self, session, params=None): sensids=sensids, chan_names=chan_names, crate_id=self.crate_id) - if not last_data_dict is None: + if last_data_dict is not None: # Check if returned keys has changed if so get new sensor names if datadict.keys() != last_data_dict.keys(): ipmbs, sensids, chan_names = self._init_data_stream(shm_addr=shm_addr) datadict = get_data_dict(shm_addr=self.shm_addr, - ipmbs=ipmbs, - sensids=sensids, - chan_names=chan_names, - crate_id=self.crate_id) + ipmbs=ipmbs, + sensids=sensids, + chan_names=chan_names, + crate_id=self.crate_id) last_data_dict = datadict data = { 'timestamp': time.time(),