-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Hi! Thanks for opening an issue. Please provide some specific details to make it easier to debug any
problems.
Environment
- Version of ethercrab in use or git hash: 0daef10
- Operating system kind and version: 6.6.62+rpt-rpi-2712 Improve slave group iteration API, add example to docs #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux
- EtherCAT devices in use: irrelevant
Description of the problem/feature request/other
In the program I'm writing, I expect occasional failures to enter OP, generally because of unconfigured SDOs, which is fine for my application. In that event, I'd like to gracefully shutdown the EtherCAT bus. However, that's not possible. Observe,
let group = match group.into_op(&maindevice).await {
Ok(group) => group,
Err(err) => {
group.into_init(&maindevice).await?; // ERROR: group was moved above and can't be used anymore
time_to_exit();
}
}
The state transition failure, along with the borrow checker, make it so group
cannot be interacted with after a state transition failure. So the question is how to solve this.
I have a couple thoughts, and I wonder what's the most right?
- Create a new group with
MainDevice
; I think it should work as-is, but it feels hacky - Add a reference to a valid
SubDeviceGroup
in theErr
type; this allows the cleanup, but makes handling Err possibly more complicated - Have
MainDevice
shut down the bus onDrop
Metadata
Metadata
Assignees
Labels
No labels