-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support reading/writing f32
, f64
and bool
#167
Conversation
Note that `f64`s cannot currently be passed to `sdo_write` as it only supports 4 byte expedited transfers currently.
f32
and f64
f32
, f64
and bool
Caution!! This has been tested with the revision 73440a6 ethercrab = { git = "https://github.com/ethercrab-rs/ethercrab.git", rev = "73440a66eca1509e6c8dd8da1aa7b4966aebc6e1", features = [
"serde",
] } Testing reading and writing bool data: let avg_mode_original = slave.sdo_read::<bool>(0x8000, 4).await?;
slave.sdo_write(0x8000, 4, false).await?;
let avg_mode_new = slave.sdo_read::<bool>(0x8000, 4).await?;
log::info!(
"Avg Mode. Original {:?}, Updated {:?}",
avg_mode_original,
avg_mode_new
); |
Testing f32 let nominal_original = slave.sdo_read::<f32>(0x8000, 0x23).await?;
slave.sdo_write(0x8000, 0x23, 4.0f32).await?;
let nominal_new = slave.sdo_read::<f32>(0x8000, 0x23).await?;
log::info!(
"Nominal. Original {:?}, Updated {:?}",
nominal_original,
nominal_new
); Output: |
Warning: This test belongs to the revision {25596d5} where bool is translated as false 0x00 true 0xff ethercrab = { git = "https://github.com/ethercrab-rs/ethercrab.git", rev = "25596d55801b295d6a0afc20cd73532415e8fd0e", features = [
"serde",
] } Testing code: let avg_mode_original = slave.sdo_read::<bool>(0x8000, 4).await?;
slave.sdo_write(0x8000, 4, false).await?;
let avg_mode_new = slave.sdo_read::<bool>(0x8000, 4).await?;
log::info!(
"Avg Mode. Original {:?}, Updated {:?}",
avg_mode_original,
avg_mode_new
); Output: |
Note that
f64
s cannot currently be passed tosdo_write
as it only supports 4 byte expedited transfers currently.