Main code.
More...
#include <Arduino.h>
#include "config.h"
#include "calibration.h"
#include "processing.h"
#include "types.h"
#include "utils.h"
#include "utils_relay.h"
#include "validation.h"
Go to the source code of this file.
Main code.
- Author
- Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
- Version
- 0.1
- Date
- 2023-02-15
- Copyright
- Copyright (c) 2023
Definition in file main.cpp.
◆ checkDiversionOnOff()
void checkDiversionOnOff |
( |
| ) |
|
Check the diversion state.
Definition at line 170 of file main.cpp.
◆ forceFullPower()
This function set all 3 loads to full power.
- Returns
- true if loads are forced
-
false
Definition at line 137 of file main.cpp.
◆ loop()
Main processor.
None of the workload in loop() is time-critical. All the processing of ADC data is done within the ISR.
Definition at line 353 of file main.cpp.
◆ proceedLoadPrioritiesAndOverriding()
bool proceedLoadPrioritiesAndOverriding |
( |
const int16_t |
currentTemperature_x100 | ) |
|
This function changes the value of the load priorities.
Since we don't have access to a clock, we detect the offPeak start from the main energy meter. Additionally, when off-peak period starts, we rotate the load priorities for the next day.
- Parameters
-
currentTemperature_x100 | current temperature x 100 (default to 0 if deactivated) |
- Returns
- true if off-peak tariff is active
-
false if on-peak tariff is active
Definition at line 271 of file main.cpp.
◆ proceedLoadPrioritiesAndOverridingDualTariff()
bool proceedLoadPrioritiesAndOverridingDualTariff |
( |
const int16_t |
currentTemperature_x100 | ) |
|
Proceed load priority in combination with dual tariff.
- Parameters
-
currentTemperature_x100 | current temperature x 100 (default to 0 if deactivated) |
- Returns
- true if high tariff (on-peak period)
-
false if low tariff (off-peak period)
Definition at line 215 of file main.cpp.
◆ proceedRotation()
Proceed load priority rotation.
Definition at line 194 of file main.cpp.
◆ setup()
Called once during startup.
This function initializes a couple of variables we cannot init at compile time and sets a couple of parameters for runtime.
Definition at line 320 of file main.cpp.