Relay diversion config and engine.
More...
#include <utils_relay.h>
|
constexpr | relayOutput ()=delete |
|
constexpr | relayOutput (const uint8_t _relay_pin) |
| Construct a new relay Config object with default parameters.
|
|
constexpr | relayOutput (uint8_t _relay_pin, int16_t _surplusThreshold, int16_t _importThreshold) |
| Construct a new relay Config object with default/custom parameters.
|
|
constexpr | relayOutput (uint8_t _relay_pin, int16_t _surplusThreshold, int16_t _importThreshold, uint16_t _minON, uint16_t _minOFF) |
| Construct a new relay Config object with custom parameters.
|
|
constexpr auto | get_importThreshold () const |
| Get the import threshold which will turns OFF the relay.
|
|
constexpr auto | get_minOFF () const |
| Get the minimum OFF-time in seconds.
|
|
constexpr auto | get_minON () const |
| Get the minimum ON-time in seconds.
|
|
constexpr auto | get_pin () const |
| Get the control pin of the relay.
|
|
constexpr auto | get_surplusThreshold () const |
| Get the surplus threshold which will turns ON the relay.
|
|
void | inc_duration () const |
| Increment the duration of the current state.
|
|
auto | isRelayON () const |
| Return the state.
|
|
void | printRelayConfiguration (uint8_t idx) const |
| Print the configuration of the current relay-diversion.
|
|
bool | proceed_relay (const int32_t currentAvgPower) const |
| Proceed with the relay.
|
|
|
bool | try_turnOFF () const |
| Turn OFF the relay if the 'time' condition is met.
|
|
bool | try_turnON () const |
| Turn ON the relay if the 'time' condition is met.
|
|
Relay diversion config and engine.
Definition at line 29 of file utils_relay.h.
◆ relayOutput() [1/4]
constexpr relayOutput::relayOutput |
( |
| ) |
|
|
constexprdelete |
◆ relayOutput() [2/4]
constexpr relayOutput::relayOutput |
( |
const uint8_t |
_relay_pin | ) |
|
|
inlineexplicitconstexpr |
Construct a new relay Config object with default parameters.
- Parameters
-
_relay_pin | Control pin for the relay |
Definition at line 39 of file utils_relay.h.
◆ relayOutput() [3/4]
constexpr relayOutput::relayOutput |
( |
uint8_t |
_relay_pin, |
|
|
int16_t |
_surplusThreshold, |
|
|
int16_t |
_importThreshold |
|
) |
| |
|
inlineconstexpr |
Construct a new relay Config object with default/custom parameters.
- Parameters
-
_relay_pin | Control pin for the relay |
_surplusThreshold | Surplus threshold to turn relay ON |
_importThreshold | Import threshold to turn relay OFF |
Definition at line 51 of file utils_relay.h.
◆ relayOutput() [4/4]
constexpr relayOutput::relayOutput |
( |
uint8_t |
_relay_pin, |
|
|
int16_t |
_surplusThreshold, |
|
|
int16_t |
_importThreshold, |
|
|
uint16_t |
_minON, |
|
|
uint16_t |
_minOFF |
|
) |
| |
|
inlineconstexpr |
Construct a new relay Config object with custom parameters.
- Parameters
-
_relay_pin | Control pin for the relay |
_surplusThreshold | Surplus threshold to turn relay ON |
_importThreshold | Import threshold to turn relay OFF |
_minON | Minimum duration in minutes to leave relay ON |
_minOFF | Minimum duration in minutes to leave relay OFF |
Definition at line 65 of file utils_relay.h.
◆ get_importThreshold()
constexpr auto relayOutput::get_importThreshold |
( |
| ) |
const |
|
inlineconstexpr |
Get the import threshold which will turns OFF the relay.
- Returns
- constexpr auto
Definition at line 95 of file utils_relay.h.
◆ get_minOFF()
constexpr auto relayOutput::get_minOFF |
( |
| ) |
const |
|
inlineconstexpr |
Get the minimum OFF-time in seconds.
- Returns
- constexpr auto
Definition at line 115 of file utils_relay.h.
◆ get_minON()
constexpr auto relayOutput::get_minON |
( |
| ) |
const |
|
inlineconstexpr |
Get the minimum ON-time in seconds.
- Returns
- constexpr auto
Definition at line 105 of file utils_relay.h.
◆ get_pin()
constexpr auto relayOutput::get_pin |
( |
| ) |
const |
|
inlineconstexpr |
Get the control pin of the relay.
- Returns
- constexpr auto
Definition at line 75 of file utils_relay.h.
◆ get_surplusThreshold()
constexpr auto relayOutput::get_surplusThreshold |
( |
| ) |
const |
|
inlineconstexpr |
Get the surplus threshold which will turns ON the relay.
- Returns
- constexpr auto
Definition at line 85 of file utils_relay.h.
◆ inc_duration()
void relayOutput::inc_duration |
( |
| ) |
const |
|
inline |
Increment the duration of the current state.
This function must be called every second.
Definition at line 135 of file utils_relay.h.
◆ isRelayON()
auto relayOutput::isRelayON |
( |
| ) |
const |
|
inline |
◆ printRelayConfiguration()
void relayOutput::printRelayConfiguration |
( |
uint8_t |
idx | ) |
const |
|
inline |
Print the configuration of the current relay-diversion.
Definition at line 166 of file utils_relay.h.
◆ proceed_relay()
bool relayOutput::proceed_relay |
( |
const int32_t |
currentAvgPower | ) |
const |
|
inline |
Proceed with the relay.
- Returns
- bool True if state has changed
Definition at line 148 of file utils_relay.h.
◆ try_turnOFF()
bool relayOutput::try_turnOFF |
( |
| ) |
const |
|
inlineprivate |
Turn OFF the relay if the 'time' condition is met.
- Returns
- bool True if state has changed
Definition at line 215 of file utils_relay.h.
◆ try_turnON()
bool relayOutput::try_turnON |
( |
| ) |
const |
|
inlineprivate |
Turn ON the relay if the 'time' condition is met.
- Returns
- bool True if state has changed
Definition at line 193 of file utils_relay.h.
◆ duration
◆ importThreshold
const int16_t relayOutput::importThreshold { 200 } |
|
private |
Import threshold to turn relay OFF
Definition at line 235 of file utils_relay.h.
◆ minOFF
const uint16_t relayOutput::minOFF { 5 * 60 } |
|
private |
Minimum duration in seconds the relay is turned OFF
Definition at line 237 of file utils_relay.h.
◆ minON
const uint16_t relayOutput::minON { 5 * 60 } |
|
private |
Minimum duration in seconds the relay is turned ON
Definition at line 236 of file utils_relay.h.
◆ relay_pin
const uint8_t relayOutput::relay_pin { 0xff } |
|
private |
◆ relayIsON
bool relayOutput::relayIsON { false } |
|
mutableprivate |
◆ surplusThreshold
const int16_t relayOutput::surplusThreshold { -1000 } |
|
private |
Surplus threshold to turn relay ON
Definition at line 234 of file utils_relay.h.
The documentation for this class was generated from the following file: