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

Compile-time validations. More...

#include "config_system.h"
#include "utils_pins.h"
#include "utils_rf.h"
#include "config_derived.h"
#include "ct_filter.h"
#include "datalog_math.h"
#include "energy_bucket.h"
#include "temp_schedule.h"
Include dependency graph for validation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PinCheck
 Result of check_pins(): whether every pin is used once, and the pins used. More...
 

Functions

constexpr bool check_boost_windows ()
 Every scheduled boost lies within the off-peak period and lasts: otherwise, it never runs (LAST(HOURS(9)) with 8 hours, FOR(MINUTES(0))), or the meter cuts it short (FIRST(HOURS(10)) with 8 hours).
 
constexpr bool check_load_priorities ()
 
constexpr bool check_override_remote_targets ()
 Each REMOTE_LOAD(n) target of an override pin must be an existing remote load.
 
constexpr bool check_override_targets ()
 Each override pin may only force local loads and relays.
 
constexpr PinCheck check_pins ()
 
constexpr bool check_relay_minimum_times ()
 Each relay's minimum ON and OFF times fit in 16 bits of seconds: 1092 minutes at most.
 
constexpr uint16_t check_relay_pins ()
 
constexpr bool claimPin (uint32_t &used, const uint8_t pin)
 Marks pin as used in used.
 
template<typename List>
constexpr bool targetsAreOutputs (const List &list)
 Overrides and boosts reach the outputs through the load states and the relay engine only, so each entry of list may only force local loads and relays.
 
template<typename List>
constexpr bool targetsAreRemoteLoads (const List &list)
 Each REMOTE_LOAD(n) target of an entry of list must be an existing remote load.
 

Detailed Description

Compile-time validations.

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 validation.h.

Function Documentation

◆ check_boost_windows()

bool check_boost_windows ( )
constexpr

Every scheduled boost lies within the off-peak period and lasts: otherwise, it never runs (LAST(HOURS(9)) with 8 hours, FOR(MINUTES(0))), or the meter cuts it short (FIRST(HOURS(10)) with 8 hours).

Note
All these checks are done by the compiler. It does not take ANY space in the Arduino.

DO NOT EDIT THIS FILE

Definition at line 57 of file validation.h.

◆ check_load_priorities()

bool check_load_priorities ( )
constexpr

Definition at line 219 of file validation.h.

Here is the call graph for this function:

◆ check_override_remote_targets()

bool check_override_remote_targets ( )
constexpr

Each REMOTE_LOAD(n) target of an override pin must be an existing remote load.

Definition at line 315 of file validation.h.

Here is the call graph for this function:

◆ check_override_targets()

bool check_override_targets ( )
constexpr

Each override pin may only force local loads and relays.

Definition at line 303 of file validation.h.

Here is the call graph for this function:

◆ check_pins()

PinCheck check_pins ( )
constexpr

Definition at line 125 of file validation.h.

Here is the call graph for this function:

◆ check_relay_minimum_times()

bool check_relay_minimum_times ( )
constexpr

Each relay's minimum ON and OFF times fit in 16 bits of seconds: 1092 minutes at most.

Definition at line 348 of file validation.h.

◆ check_relay_pins()

uint16_t check_relay_pins ( )
constexpr

Definition at line 324 of file validation.h.

◆ claimPin()

bool claimPin ( uint32_t & used,
const uint8_t pin )
constexpr

Marks pin as used in used.

Returns
false if it was already used. A pin from 32 on (not a pin of an ATmega328P) sets bit 31, which the range check below refuses, as it does every pin from 14 on.

Definition at line 117 of file validation.h.

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

◆ targetsAreOutputs()

template<typename List>
bool targetsAreOutputs ( const List & list)
constexpr

Overrides and boosts reach the outputs through the load states and the relay engine only, so each entry of list may only force local loads and relays.

Template Parameters
ListOverridePins or ScheduledBoosts

Definition at line 246 of file validation.h.

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

◆ targetsAreRemoteLoads()

template<typename List>
bool targetsAreRemoteLoads ( const List & list)
constexpr

Each REMOTE_LOAD(n) target of an entry of list must be an existing remote load.

REMOTE_LOAD() counts from 0: with two remote loads, REMOTE_LOAD(2) is a third one that does not exist, and the entry would force nothing. From 8 on, REMOTE_LOAD() gives pin 0 (the masks hold 8 remote loads): targetsAreOutputs() rejects it.

Template Parameters
ListOverridePins or ScheduledBoosts

Definition at line 281 of file validation.h.

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