Skip to content

CA Command PVs should be set back to zero when complete #291

@GDYendell

Description

@GDYendell

This could work

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions