DiamondLightSource / DiamondLightSource/fastcs

CA Command PVs should be set back to zero when complete

Open
#291 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
8
Avg merge
2d 12h
Merged PRs (30d)
3

Description

New plan: https://github.com/DiamondLightSource/FastCS/issues/291#issuecomment-3834270492

---

This could work

```python
def _create_and_link_command_pv(
pv_prefix: str, pv_name: str, attr_name: str, method: Command
) -> None:
pv = f"{pv_prefix}:{pv_name}"

async def wrapped_method(value: Any):
if not value:
return

tracer.log_event("Command PV put", topic=method, pv=pv)

await method.fn()

record.set(0, process=False)

record = builder.Action(
f"{pv_prefix}:{pv_name}",
on_update=wrapped_method,
blocking=True,
initial_value=0,
ZNAM="Idle",
ONAM="Active",
)
```

Is this the right thing to do? The `if not value` seems to be necessary to stop it calling in a loop, despite the `process=False`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.