3-phase PV router
Loading...
Searching...
No Matches
utils.h File Reference

Some utility functions. More...

#include <Arduino.h>
#include "FastDivision.h"
#include "config_derived.h"
#include "constants.h"
#include "dualtariff.h"
#include "energy_bucket.h"
#include "processing.h"
#include "serial_output.h"
#include "shared_var.h"
#include "teleinfo.h"
#include "utils_rf.h"
#include "utils_temp.h"
#include "version.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TeleInfoData
 The data of the IoT frame, for TeleInfo::writeFrameStep(). More...
 

Functions

int freeRam ()
 Get the available RAM during setup.
 
void infolnPresence (const bool present)
 Print "is present" or "is NOT present", and a line end.
 
void logLoadPriorities ()
 Prints the load priorities to the Serial output.
 
template<bool newBoard>
void printCalibration (const uint8_t phase)
 Print the calibration of a phase as calibration.h has it.
 
void printCalibrationLine (const __FlashStringHelper *name, const uint8_t phase, const int32_t *value, const uint8_t decimals)
 Print one calibration line: "<name> for L<phase> = <value>".
 
void printConfiguration ()
 Print the configuration during startup.
 
bool printJsonStep (Print &out, uint8_t step)
 One step of the datalog in JSON format.
 
void printRotationGroups ()
 Prints the rotation groups, as load numbers counted from 0 as in LOAD(n): "\tgroups { 0 1 2 } { 3 4 5 }".
 
bool printTextStep (Print &out, uint8_t step)
 One step of the datalog in text format.
 
void sendResults (bool bOffPeak)
 Prints or sends telemetry data logs based on the selected output format.
 
bool writeTeleInfoStep (Print &out, uint8_t step)
 One step of the telemetry frame, in IoT format: one line (see TeleInfo::writeFrameStep()).
 

Variables

bool datalogOffPeak { false }
 

Detailed Description

Some utility functions.

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
2026-11-26

Definition in file utils.h.

Function Documentation

◆ infolnPresence()

void infolnPresence ( const bool present)
inline

Print "is present" or "is NOT present", and a line end.

Each F("...") is a string of its own in flash, even with the same text: the features print these two through here, so each is stored once.

Parameters
presentWhether the feature is present.

Definition at line 67 of file utils.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printCalibration()

template<bool newBoard>
void printCalibration ( const uint8_t phase)
inline

Print the calibration of a phase as calibration.h has it.

The new board: f_ctRating, f_powerCalPerAmp and f_voltageCalNewBoard; the old board: f_powerCalOldBoard and f_voltageCalOldBoard. The f_powerCal the router computes from them is not printed: what can be checked is what was typed. A template, so that each build compiles only its board's branch (its strings included).

Template Parameters
newBoardwhether the router runs with the new board's calibration
Parameters
phasethe phase, 0 for L1

Definition at line 102 of file utils.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printCalibrationLine()

void printCalibrationLine ( const __FlashStringHelper * name,
const uint8_t phase,
const int32_t * value,
const uint8_t decimals )
inline

Print one calibration line: "<name> for L<phase> = <value>".

Parameters
namethe name in calibration.h, with its leading tab
phasethe phase, 0 for L1
valuethe value in PROGMEM, scaled by 10^decimals
decimalsthe number of decimals

Definition at line 80 of file utils.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ datalogOffPeak

bool datalogOffPeak { false }
inline

tariff at the datalog being printed, for the JSON and IoT formats

Definition at line 296 of file utils.h.