10 { 3, 100, 20, 2, 3 } } };
25 TEST_ASSERT_EQUAL(4, relay.
get_pin());
33 TEST_ASSERT_EQUAL(4, relay.
get_pin());
41 TEST_ASSERT_EQUAL(4, relay.
get_pin());
85 TEST_ASSERT_FALSE(my_relay.isRelayON());
88 const auto surplus{ -my_relay.get_surplusThreshold() - 1 };
90 TEST_ASSERT_FALSE(my_relay.proceed_relay(surplus));
92 TEST_ASSERT_FALSE(my_relay.isRelayON());
94 for (uint8_t timer = 0; timer < my_relay.get_minOFF() - 1; ++timer)
96 my_relay.inc_duration();
98 TEST_ASSERT_FALSE(my_relay.proceed_relay(surplus));
101 my_relay.inc_duration();
103 TEST_ASSERT_TRUE(my_relay.proceed_relay(surplus));
104 TEST_ASSERT_TRUE(my_relay.isRelayON());
111 TEST_ASSERT_TRUE(my_relay.isRelayON());
114 const auto consum{ my_relay.get_importThreshold() + 1 };
116 TEST_ASSERT_FALSE(my_relay.proceed_relay(consum));
118 TEST_ASSERT_TRUE(my_relay.isRelayON());
120 for (uint8_t timer = 0; timer < my_relay.get_minON() - 1; ++timer)
122 my_relay.inc_duration();
124 TEST_ASSERT_FALSE(my_relay.proceed_relay(consum));
127 my_relay.inc_duration();
129 TEST_ASSERT_TRUE(my_relay.proceed_relay(consum));
130 TEST_ASSERT_FALSE(my_relay.isRelayON());
This class implements the relay management engine.
constexpr auto get_size() const
Get the number of relays.
constexpr const auto & get_relay(uint8_t idx) const
Get the relay object.
void initializePins() const
Initialize the pins used by the relays.
Relay diversion config and engine.
constexpr auto get_surplusThreshold() const
Get the surplus threshold which will turns ON the relay.
constexpr auto get_importThreshold() const
Get the import threshold which will turns OFF the relay.
constexpr auto get_pin() const
Get the control pin of the relay.
void test_get_minOFF(void)
void test_proceed_relay(void)
constexpr RelayEngine relays
void test_isRelayON(void)
void test_relay_turnOFF(void)
void test_get_minON(void)
void test_get_surplusThreshold(void)
void test_relay_initialization_with_positive_thresholds(void)
void test_get_importThreshold(void)
void test_relay_initialization(void)
void test_relay_turnON(void)
void test_relay_initialization_with_negative_thresholds(void)
Some utility functions for pins manipulation.
Some utility functions for the relay output feature.