Skip to content

Add EtherCAT example to list slaves - #53

Merged
flosse merged 8 commits into
ethercat-rs:masterfrom
ulikoehler:list-salves-example
Nov 2, 2025
Merged

flosse merged 8 commits into
ethercat-rs:masterfrom
ulikoehler:list-salves-example

Conversation

@ulikoehler

Copy link
Copy Markdown
Contributor

Stripped output:

$ cargo run --example list_slaves
Slave pos 0: SlaveInfo { name: "AS715N_sAxis_V0.10", ring_pos: 0, id: SlaveId { vendor_id: 4194304, product_code: 1813 }, rev: SlaveRev { revision_number: 12024, serial_number: 0 }, alias: 0, current_on_ebus: 0, al_state: PreOp, error_flag: 0, sync_count: 4, sdo_count: 0, ports: [SlavePortInfo { desc: MII, link: SlavePortLink { link_up: true, loop_closed: false, signal_detected: true }, receive_time: 979090354, next_slave: 65535, delay_to_next_dc: 0 }, SlavePortInfo { desc: MII, link: SlavePortLink { link_up: false, loop_closed: true, signal_detected: false }, receive_time: 1413563250, next_slave: 65535, delay_to_next_dc: 0 }, SlavePortInfo { desc: NotImplemented, link: SlavePortLink { link_up: false, loop_closed: true, signal_detected: false }, receive_time: 0, next_slave: 65535, delay_to_next_dc: 0 }, SlavePortInfo { desc: NotImplemented, link: SlavePortLink { link_up: false, loop_closed: true, signal_detected: false }, receive_time: 0, next_slave: 65535, delay_to_next_dc: 0 }] }
Discovered 1 slaves (checked positions 0..31)

The example compiles without any errors. I didn't want to add serde_json etc just for nicer formatting, since this is not really intended as a diagnostic tool, but more like a syntax example.

Comment thread examples/list_slaves.rs Outdated
Comment thread examples/list_slaves.rs Outdated
Comment thread examples/list_slaves.rs
Comment thread examples/list_slaves.rs Outdated
ulikoehler and others added 2 commits November 2, 2025 21:22
Co-authored-by: Markus Kohlhase <mail@markus-kohlhase.de>
Co-authored-by: Markus Kohlhase <mail@markus-kohlhase.de>
Comment thread examples/list_slaves.rs Outdated
Comment thread examples/list_slaves.rs Outdated
@flosse

flosse commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

@ulikoehler
Thanks for your contribution!
Examples are great, they show how to use this crate and also act as some kind of "API test".
In principle, everything looks fine, just a few minor issues that still need to be resolved.

@ulikoehler

Copy link
Copy Markdown
Contributor Author

@flosse Thanks for the quick review. I've already resolved all issues, and would appreciate feedback on the non-resolved issue regarding the comments.

About the CI pipeline failing, I believe this is unrelated to this PR, right?

@flosse
flosse merged commit a4776ab into ethercat-rs:master Nov 2, 2025
1 of 4 checks passed
@ulikoehler

Copy link
Copy Markdown
Contributor Author

Thank you @flosse for the quick merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants