TemperatureCorrection

Struct TemperatureCorrection 

Source
pub struct TemperatureCorrection(/* private fields */);
Expand description

Represents the temperature correction values for all 8 channels. Correction values are added to the raw temperature reading. Setting a correction value to 0 disables correction for that channel.

Implementations§

Source§

impl TemperatureCorrection

Source

pub const ADDRESS: u16 = 8u16

Starting Modbus register address for reading/writing correction values.

Source

pub const QUANTITY: u16 = 8u16

Number of Modbus registers required for all channel correction values.

Source

pub fn decode_from_holding_registers(words: &[Word]) -> Result<Self, Error>

Decodes TemperatureCorrection values for all channels from a slice of Modbus holding register values.

Expects a slice containing NUMBER_OF_CHANNELS words.

§Arguments
  • words - A slice of Word containing the register values for all correction channels.
§Returns

A TemperatureCorrection struct containing the decoded value.

§Errors
Source

pub fn iter(&self) -> Iter<'_, Temperature>

Returns an iterator over the individual Temperature correction values.

Source

pub fn as_slice(&self) -> &[Temperature]

Returns a slice containing all Temperature correction values.

Source

pub fn as_array(&self) -> &[Temperature; 8]

Provides direct access to the underlying array of port states.

Source

pub fn encode_for_write_register( correction_value: Temperature, ) -> Result<Word, Error>

Encodes a single Temperature correction value into a Word for writing to the appropriate channel register.

Use channel_address to determine the correct register address for writing.

§Arguments
  • correction_value - The Temperature correction value to encode.
§Returns

The Word representation of the correction value.

§Errors

Returns an Error::EncodeError if the correction_value is NAN.

Source

pub fn channel_address(channel: Channel) -> u16

Calculates the Modbus register address for a specific channel’s correction value.

§Arguments
  • channel - The Channel for which to get the correction register address.
§Returns

The u16 Modbus register address.

Trait Implementations§

Source§

impl Clone for TemperatureCorrection

Source§

fn clone(&self) -> TemperatureCorrection

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TemperatureCorrection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TemperatureCorrection

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TemperatureCorrection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the correction values as a comma-separated string.

Source§

impl Index<usize> for TemperatureCorrection

Source§

fn index(&self, index: usize) -> &Self::Output

Allows indexing into the corrections array (e.g., corrections[0] for CH1).

§Panics

Panics if the index is out of bounds (0-7).

Source§

type Output = Temperature

The returned type after indexing.
Source§

impl<'a> IntoIterator for &'a TemperatureCorrection

Source§

type Item = &'a Temperature

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Temperature>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for TemperatureCorrection

Source§

type Item = Temperature

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Temperature, NUMBER_OF_CHANNELS>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for TemperatureCorrection

Source§

fn eq(&self, other: &TemperatureCorrection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TemperatureCorrection

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for TemperatureCorrection

Source§

impl StructuralPartialEq for TemperatureCorrection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,