Skip to content

Commit

Permalink
[TASK] handle x plane sign, deativate bpm's per hand
Browse files Browse the repository at this point in the history
  • Loading branch information
OPerator Interface for PTB committed Jan 14, 2025
1 parent 95d10bc commit 0ee484a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/bpm_data_combiner/app/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def reset(self):

def new_value(self, dev_name: str, values: np.ndarray[np.int32]):
cnt_h, cnt_l, x, y, sum, q, a, b, c, d = values
# todo: only do it here!
# x-plane correction
x = -x
cnt = combine_counts(cnt_h, cnt_l)
# should be handled by monitor_device status
self.dev_status(dev_name=dev_name, field=StatusField.active, value=True)
Expand Down Expand Up @@ -184,7 +187,8 @@ def _on_new_collection_ready(self, col: CollectionItemInterface):
self.accumulator.add(data)
logger.info("added collection, accumulator length now %s", len(self.accumulator))
self.views.ready_data.update(data)

# self.periodic_trigger()

def _on_device_status_changed(self):
# collector needs to know which devices are active
dev_names = self.monitor_devices.get_device_names()
Expand Down
10 changes: 9 additions & 1 deletion src/bpm_data_combiner/app/softioc_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def heart_beat(controller):
async def periodic_update(controller):
while True:
# first data after 2 seconds ...
await asyncio.sleep(2.0)
await asyncio.sleep(0.5)
try:
controller.periodic_trigger()
except NoCollectionsError as nc:
Expand All @@ -68,6 +68,13 @@ def main():
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
builder.SetDeviceName("OrbCol")
controller = Controller(prefix="", device_names=_dev_names)
# deselect some bpms
for dev_name in ["BPMZ4L4RP"]:
continue
controller.update(dev_name=dev_name, enabled=False, plane="x")
controller.update(dev_name=dev_name, enabled=False, plane="y")


builder.LoadDatabase()
softioc.iocInit(dispatcher)

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

# Finally leave the IOC running with an interactive shell.
Expand Down

0 comments on commit 0ee484a

Please sign in to comment.