Skip to content

Commit 0ee484a

Browse files
author
OPerator Interface for PTB
committed
[TASK] handle x plane sign, deativate bpm's per hand
1 parent 95d10bc commit 0ee484a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/bpm_data_combiner/app/controller.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def reset(self):
128128

129129
def new_value(self, dev_name: str, values: np.ndarray[np.int32]):
130130
cnt_h, cnt_l, x, y, sum, q, a, b, c, d = values
131+
# todo: only do it here!
132+
# x-plane correction
133+
x = -x
131134
cnt = combine_counts(cnt_h, cnt_l)
132135
# should be handled by monitor_device status
133136
self.dev_status(dev_name=dev_name, field=StatusField.active, value=True)
@@ -184,7 +187,8 @@ def _on_new_collection_ready(self, col: CollectionItemInterface):
184187
self.accumulator.add(data)
185188
logger.info("added collection, accumulator length now %s", len(self.accumulator))
186189
self.views.ready_data.update(data)
187-
190+
# self.periodic_trigger()
191+
188192
def _on_device_status_changed(self):
189193
# collector needs to know which devices are active
190194
dev_names = self.monitor_devices.get_device_names()

src/bpm_data_combiner/app/softioc_main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def heart_beat(controller):
5555
async def periodic_update(controller):
5656
while True:
5757
# first data after 2 seconds ...
58-
await asyncio.sleep(2.0)
58+
await asyncio.sleep(0.5)
5959
try:
6060
controller.periodic_trigger()
6161
except NoCollectionsError as nc:
@@ -68,6 +68,13 @@ def main():
6868
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
6969
builder.SetDeviceName("OrbCol")
7070
controller = Controller(prefix="", device_names=_dev_names)
71+
# deselect some bpms
72+
for dev_name in ["BPMZ4L4RP"]:
73+
continue
74+
controller.update(dev_name=dev_name, enabled=False, plane="x")
75+
controller.update(dev_name=dev_name, enabled=False, plane="y")
76+
77+
7178
builder.LoadDatabase()
7279
softioc.iocInit(dispatcher)
7380

@@ -76,6 +83,7 @@ def main():
7683
dispatcher(bpm_data_receive, func_args=(controller, dev_name,))
7784
dispatcher(bpm_data_sync_stat, func_args=(controller, dev_name,))
7885
dispatcher(heart_beat, func_args=(controller,))
86+
# todo: check if controller does not call it by itself
7987
dispatcher(periodic_update, func_args=(controller,))
8088

8189
# Finally leave the IOC running with an interactive shell.

0 commit comments

Comments
 (0)