|
3-phase PV router
|
Functions and routines that handle general system processing tasks. More...
Files | |
| file | override_masks.h |
| The forced outputs: the override pins, and the scheduled boosts of the dual tariff. | |
| file | pin_edges.h |
| The edges of the active-LOW input pins: pressed, released, or no change. | |
Classes | |
| class | EWMA_average< A > |
| Implements an Exponentially Weighted Moving Average (EWMA). More... | |
Functions | |
| OverrideMasks | getOverrideBitmask (const bool bOffPeak, const int16_t currentTemperature_x100) |
| Gets the combined bitmasks of all active override pins and dual tariff forcing. | |
| void | handlePerSecondTasks (bool &bOffPeak, int16_t &iTemperature_x100) |
| Handles tasks that need to be executed every second. | |
| bool | isDiversionEnabled () |
| Reads the diversion pin. | |
| bool | isRouterOff () |
| Tells whether the router is OFF. | |
| void | logLoadPriorities () |
| Prints the load priorities to the Serial output. | |
| void | loop () |
| Main processor loop. | |
| bool | proceedDualTariffLogic () |
| Handles dual tariff state transitions and priority rotation during off-peak periods. | |
| void | proceedLoadPriorities (const bool bOverridden) |
| Handles load priority rotation. | |
| void | proceedRotation () |
| Proceeds with load priority rotation. | |
| template<uint8_t pin> | |
| PinEdges | readPinEdges () |
| Reads an active-LOW input pin, and tells how it changed since the previous reading. | |
| void | sendResults (bool bOffPeak) |
| Prints or sends telemetry data logs based on the selected output format. | |
| void | updatePowerAndVoltageData () |
| Updates power and voltage data for all phases. | |
Functions and routines that handle general system processing tasks.
This group includes functions that are not time-critical but are essential for the overall operation of the system. These tasks include monitoring system states, managing load priorities, and handling diversion logic.
| OverrideMasks getOverrideBitmask | ( | const bool | bOffPeak, |
| const int16_t | currentTemperature_x100 ) |
Gets the combined bitmasks of all active override pins and dual tariff forcing.
This function calculates the complete override bitmasks (local and remote) by combining external override pins with dual tariff automatic forcing. The bitwise OR operation automatically handles precedence where external overrides take priority over dual tariff forcing for the same pins.
| bOffPeak | true if the system is in an off-peak period (used for dual tariff logic). |
| currentTemperature_x100 | Current temperature multiplied by 100 (used for dual tariff logic). |
Definition at line 113 of file main.cpp.


| void handlePerSecondTasks | ( | bool & | bOffPeak, |
| int16_t & | iTemperature_x100 ) |
Handles tasks that need to be executed every second.
This function performs various tasks that are triggered once per second, ensuring proper system operation and load management.
| bOffPeak | Reference to the off-peak state flag. |
| iTemperature_x100 | Current temperature multiplied by 100 (default to 0 if temperature sensing is disabled). |
Definition at line 512 of file main.cpp.


| bool isDiversionEnabled | ( | ) |
| bool isRouterOff | ( | ) |
|
inline |
Prints the load priorities to the Serial output.
This function logs the current load priorities and states to the Serial output at startup and after each priority rotation. It provides a detailed view of the load configuration and their respective priorities.
Definition at line 660 of file utils.h.


| void loop | ( | ) |
Main processor loop.
This function handles non-time-critical tasks such as load management, telemetry updates, and temperature sensing. It processes ADC data through flags set by the ISR and ensures proper system operation.
b_newMainsCycle flag, which is set once per mains cycle; with temperature sensing, the cycle's 1-Wire transaction first, before any other work.Definition at line 564 of file main.cpp.

| bool proceedDualTariffLogic | ( | ) |
Handles dual tariff state transitions and priority rotation during off-peak periods.
This function manages dual tariff state detection and triggers priority rotation when transitioning to off-peak periods. The actual load forcing is handled in getOverrideBitmask().
Definition at line 249 of file main.cpp.


| void proceedLoadPriorities | ( | const bool | bOverridden | ) |
Handles load priority rotation.
This function manages load priority rotation behavior based on the system configuration. It supports priority rotation via pin control or automatic rotation. Override logic is handled in getOverrideBitmask().
| bOverridden | true while a load, relay or remote load is forced: no rotation then. |
proceedDualTariffLogic rotates when off-peak starts instead.Definition at line 294 of file main.cpp.


| void proceedRotation | ( | ) |
Proceeds with load priority rotation.
This function triggers the rotation of load priorities and waits until the rotation is completed. It ensures that the new load priorities are logged after the rotation.
b_reOrderLoads flag to initiate the rotation process.Definition at line 218 of file main.cpp.


| PinEdges readPinEdges | ( | ) |
Reads an active-LOW input pin, and tells how it changed since the previous reading.
| pin | the input pin: each one keeps its own previous level, released at startup. |
Read each pin every second, whether its edges are used or not: a previous level left stale would turn a press made long ago into an edge now.
Definition at line 142 of file main.cpp.


|
inline |
Prints or sends telemetry data logs based on the selected output format.
This function handles the transmission of telemetry data in various formats, such as human-readable text, IoT telemetry, or JSON format. It also ensures that the first incomplete datalogging event is skipped during startup.
| bOffPeak | Indicates whether the system is in an off-peak tariff period. |
SERIAL_OUTPUT_TYPE, it prints data in text format, sends telemetry data, or outputs data in JSON format.Definition at line 602 of file utils.h.


| void updatePowerAndVoltageData | ( | ) |
Updates power and voltage data for all phases.
This function calculates the power and voltage for each phase based on the accumulated data during the datalogging period. It also updates the total power.
Definition at line 385 of file main.cpp.

