pub struct El3356 {
pub peak_load: f32,
pub busy: bool,
pub error: bool,
pub error_message: String,
pub configured_mv_v: Option<f32>,
pub configured_full_scale_load: Option<f32>,
pub configured_scale_factor: Option<f32>,
/* private fields */
}Expand description
Function block for the Beckhoff EL3356 strain-gauge terminal.
Fields§
§peak_load: f32Largest absolute load seen since construction, last reset, or last tare.
busy: boolTrue while a configuration sequence is in progress.
error: boolTrue after an SDO operation failed. Clear with clear_error.
error_message: StringLast error message, if any.
configured_mv_v: Option<f32>Last successfully written sensitivity (mV/V). None until a
configure() has completed.
configured_full_scale_load: Option<f32>Last successfully written full-scale load. None until a configure()
has completed.
configured_scale_factor: Option<f32>Last successfully written scale factor. None until a configure()
has completed.
Implementations§
Source§impl El3356
impl El3356
Sourcepub fn new(device: &str) -> Self
pub fn new(device: &str) -> Self
Create a new EL3356 function block for the given EtherCAT device name.
device must match the name used in project.json’s ethercat device
list (it’s the device field sent with every SDO request).
Sourcepub fn tick(&mut self, view: &mut El3356View<'_>, client: &mut CommandClient)
pub fn tick(&mut self, view: &mut El3356View<'_>, client: &mut CommandClient)
Call every control cycle.
Performs three things, in order:
- Updates
peak_loadfrom*view.load. - Releases the tare pulse after 100 ms.
- Progresses any in-flight SDO operation from
configure.
Sourcepub fn configure(
&mut self,
client: &mut CommandClient,
full_scale_load: f32,
sensitivity_mv_v: f32,
scale_factor: f32,
)
pub fn configure( &mut self, client: &mut CommandClient, full_scale_load: f32, sensitivity_mv_v: f32, scale_factor: f32, )
Begin an SDO configuration sequence: sensitivity (mV/V), full-scale
load, and scale factor written to object 0x8000 subs 0x23, 0x24,
and 0x27 respectively. Non-blocking — sets busy = true and returns
immediately. Poll busy / error on subsequent ticks.
No-op (logs a warning) if the FB is already busy. Any existing error
flag is cleared at the start of a new sequence.
Sourcepub fn reset_peak(&mut self)
pub fn reset_peak(&mut self)
Reset peak_load to 0.0. Immediate; no IPC.
Sourcepub fn tare(&mut self)
pub fn tare(&mut self)
Pulse the tare bit high for 100 ms, and reset the peak.
The device-side bit (view.tare) is actually written by tick,
so tick must be called every cycle. If tare is called while a
previous pulse is still in progress, the 100 ms window restarts.
Sourcepub fn clear_error(&mut self)
pub fn clear_error(&mut self)
Clear the error flag and message.
Sourcepub fn sdo_write(
&mut self,
client: &mut CommandClient,
index: u16,
sub_index: u8,
value: Value,
) -> u32
pub fn sdo_write( &mut self, client: &mut CommandClient, index: u16, sub_index: u8, value: Value, ) -> u32
Low-level SDO write pass-through. Does not interact with the FB’s
busy/state fields — use for advanced operations (e.g. changing the
filter mode at runtime) that don’t fit the configure
pattern.