LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
Actuators Namespace Reference

Globally stores all actuators (relays) and to operates over them. More...

Typedefs

using PackedActuatorStateBytes = etl::array< uint8_t, CONFIG_PACKED_ACTUATOR_STATE_STORAGE_CAPACITY >
 Compact shadow of the full actuator runtime state in protocol bit order.
 

Functions

auto getId (uint8_t actuatorIndex) -> uint8_t
 Return the static wire ID for one registered actuator index.
 
auto getActuator (uint8_t actuatorId) -> Actuator *
 Get a single actuator.
 
auto getIndex (uint8_t actuatorId) -> uint8_t
 Get a single actuator index (in device vector of actuators).
 
auto tryGetIndex (uint8_t actuatorId, uint8_t &actuatorIndex) -> bool
 Resolves an actuator ID to its dense runtime index with a single map lookup.
 
auto actuatorExists (uint8_t actuatorId) -> bool
 Get if the actuator actually exists.
 
void recordSwitchTime (uint8_t actuatorIndex, uint32_t now_ms)
 Records the latest switch time for an actuator when compact actuator timer storage is enabled.
 
void updatePackedState (uint8_t actuatorIndex, bool state)
 Keep the compact actuator-state shadow aligned with one runtime state change.
 
auto getPackedStateByteCount () -> uint8_t
 Return the number of packed bytes required by the current topology.
 
auto getPackedStateByte (uint8_t byteIndex) -> uint8_t
 Return one packed state byte in protocol wire order.
 
void finalizeSetup ()
 Final validation after actuator registration.
 
template<uint8_t ActuatorIndex>
 __attribute__ ((always_inline)) inline void updatePackedStateStatic(bool state)
 Keep the packed actuator-state shadow aligned using a generated index.
 

Variables

PackedActuatorStateBytes packedActuatorStates {}
 Canonical packed actuator-state shadow kept in sync with Actuator::setState().
 

Detailed Description

Globally stores all actuators (relays) and to operates over them.

Typedef Documentation

◆ PackedActuatorStateBytes

using Actuators::PackedActuatorStateBytes = typedef etl::array<uint8_t, CONFIG_PACKED_ACTUATOR_STATE_STORAGE_CAPACITY>

Compact shadow of the full actuator runtime state in protocol bit order.

Bit 0 maps to actuator index 0, bit 1 to actuator index 1, and so on. The serializer can therefore emit ACTUATORS_STATE directly from this cached representation without rescanning every actuator object.

Function Documentation

◆ __attribute__()

template<uint8_t ActuatorIndex>
Actuators::__attribute__ ( (always_inline)  )

Keep the packed actuator-state shadow aligned using a generated index.

Generated profiles already know the dense actuator index at compile time. Keeping this tiny helper in the header lets AVR-GCC fold the byte index and bit mask instead of paying a runtime shift/mask path for every static actuator transition.

Template Parameters
ActuatorIndexDense runtime actuator index from the static profile.
Parameters
statenew actuator state.

◆ actuatorExists()

auto Actuators::actuatorExists ( uint8_t  actuatorId) -> bool

Get if the actuator actually exists.

Parameters
actuatorIdUnique ID of the actuator.
Returns
true if actuator exists.
false if actuator doesn't exist.
Here is the call graph for this function:

◆ getActuator()

auto Actuators::getActuator ( uint8_t  actuatorId) -> Actuator *

Get a single actuator.

Parameters
actuatorIdactuator UUID.
Returns
Actuator* A single actuator when the ID exists.
nullptr When the ID is unknown.
Here is the call graph for this function:

◆ getId()

auto Actuators::getId ( uint8_t  actuatorIndex) -> uint8_t

Return the static wire ID for one registered actuator index.

Parameters
actuatorIndexdense runtime actuator index.
Returns
uint8_t actuator ID, or zero when the index is outside the static profile.
Here is the caller graph for this function:

◆ getIndex()

auto Actuators::getIndex ( uint8_t  actuatorId) -> uint8_t

Get a single actuator index (in device vector of actuators).

Parameters
actuatorIdactuator UUID.
Returns
uint8_t A single actuator index (in device vector of actuators).
UINT8_MAX When the ID is unknown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPackedStateByte()

auto Actuators::getPackedStateByte ( uint8_t  byteIndex) -> uint8_t

Return one packed state byte in protocol wire order.

Return one packed actuator-state byte in protocol wire order.

Parameters
byteIndexpacked byte index.
Returns
uint8_t packed actuator-state byte, or zero when out of range.
Parameters
byteIndexpacked byte index.
Returns
uint8_t packed actuator-state byte, or zero when byteIndex is out of range.

◆ getPackedStateByteCount()

auto Actuators::getPackedStateByteCount ( ) -> uint8_t

Return the number of packed bytes required by the current topology.

Return the number of packed bytes required by the active actuator topology.

Returns
uint8_t number of bytes needed by the compact ACTUATORS_STATE payload.

◆ recordSwitchTime()

void Actuators::recordSwitchTime ( uint8_t  actuatorIndex,
uint32_t  now_ms 
)

Records the latest switch time for an actuator when compact actuator timer storage is enabled.

Parameters
actuatorIndexdense runtime actuator index.
now_mscached switch timestamp.

◆ tryGetIndex()

auto Actuators::tryGetIndex ( uint8_t  actuatorId,
uint8_t &  actuatorIndex 
) -> bool

Resolves an actuator ID to its dense runtime index with a single map lookup.

Parameters
actuatorIdActuator UUID.
actuatorIndexOutput runtime index when the ID exists.
Returns
true if the actuator exists.
false otherwise.
Here is the caller graph for this function:

◆ updatePackedState()

void Actuators::updatePackedState ( uint8_t  actuatorIndex,
bool  state 
)

Keep the compact actuator-state shadow aligned with one runtime state change.

Parameters
actuatorIndexdense runtime actuator index.
statenew actuator state.

Variable Documentation

◆ packedActuatorStates

PackedActuatorStateBytes Actuators::packedActuatorStates {}

Canonical packed actuator-state shadow kept in sync with Actuator::setState().

Canonical packed actuator-state shadow kept aligned with runtime changes.

The bridge serializer consumes this compact representation directly, so actuator state reporting no longer has to rebuild protocol bytes by rescanning every actuator object.