3-phase PV router
|
Main code for the PVRouter 3-phase project. More...
#include <Arduino.h>
#include "config.h"
#include "calibration.h"
#include "processing.h"
#include "shared_var.h"
#include "types.h"
#include "utils.h"
#include "utils_relay.h"
#include "validation.h"
#include "main.h"
Go to the source code of this file.
Functions | |
void | checkDiversionOnOff () |
Checks and updates the diversion state based on the diversion pin. | |
uint16_t | getDualTariffForcingBitmask (const int16_t currentTemperature_x100) |
Calculates the dual tariff forcing bitmask based on current conditions. | |
uint16_t | getOverrideBitmask (const int16_t currentTemperature_x100) |
Gets the combined bitmask 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. | |
void | loop () |
Main processor loop. | |
bool | proceedDualTariffLogic () |
Handles dual tariff state transitions and priority rotation during off-peak periods. | |
bool | proceedLoadPriorities (const int16_t ¤tTemperature_x100) |
Handles load priority rotation and dual tariff state transitions. | |
void | proceedRotation () |
Proceeds with load priority rotation. | |
void | processTemperatureData () |
Processes temperature data from DS18B20 sensors. | |
void | setup () |
Called once during startup. | |
void | updatePowerAndVoltageData () |
Updates power and voltage data for all phases. | |
Main code for the PVRouter 3-phase project.
This file contains the main logic for the PVRouter, including the setup and loop functions, as well as interrupt service routines (ISRs) and utility functions for managing load priorities, temperature sensing, and telemetry data.
Definition in file main.cpp.
void processTemperatureData | ( | ) |
Processes temperature data from DS18B20 sensors.
This function reads temperature values from all connected DS18B20 sensors, filters out invalid readings, and updates the telemetry data structure with valid temperature values. Invalid readings are identified as 85.00°C (encoded as 8500) with a delta greater than 5.00°C (encoded as 500) from the previous reading. After processing, it requests new temperature measurements for the next cycle.
temperatureSensing
object must be initialized and configured with the connected DS18B20 sensors.tx_data.temperature_x100
array is updated with the latest valid temperature readings. Definition at line 411 of file main.cpp.