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

Unit grouping and payload bookkeeping for remotely controlled loads. More...

#include <stdint.h>
#include "load_map.h"
Include dependency graph for remote_loads_core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RemoteLoadCore< NumUnits >
 Builds and schedules the RF payloads of every remote unit. More...
 
struct  RemoteUnitState
 Transmission bookkeeping for one remote unit. More...
 

Functions

template<uint8_t NumIds>
constexpr bool areValidNodeIds (const uint8_t(&nodeIds)[NumIds], uint8_t numUnits, uint8_t routerId)
 Check the node IDs of the first numUnits remote units.
 

Variables

constexpr uint8_t REMOTE_REFRESH_CYCLES { 5 }
 

Detailed Description

Unit grouping and payload bookkeeping for remotely controlled loads.

Author
Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
Version
1.0
Date
2026-11-21

Given the load map (see load_map.h) and the current state of every dump load, this builds one RF payload per remote unit and decides when a transmission is due. It knows nothing about the radio itself: the actual send lives in remote_loads.h, outside the ISR.

Each unit is sent one byte, one bit per load: **bit b of a unit's payload is the b-th load of that unit in ascending physicalLoadPin[] order.** The receiver must agree.

A payload is transmitted when it changes, and otherwise refreshed every REMOTE_REFRESH_CYCLES mains cycles so a receiver that missed a packet - or was powered up late - converges within 100 ms.

Note
This header has no Arduino dependency (its whole include closure is <stdint.h> and load_map.h) so it can be exercised by the native test suite.

Definition in file remote_loads_core.h.

Function Documentation

◆ areValidNodeIds()

template<uint8_t NumIds>
bool areValidNodeIds ( const uint8_t(&) nodeIds[NumIds],
uint8_t numUnits,
uint8_t routerId )
constexpr

Check the node IDs of the first numUnits remote units.

Each must lie in 1..30, differ from the router's own ID, and be unique.

Parameters
nodeIdsNode ID table, unit 1 first.
numUnitsNumber of units actually addressed.
routerIdNode ID of the router itself.

Definition at line 48 of file remote_loads_core.h.

Here is the caller graph for this function:

Variable Documentation

◆ REMOTE_REFRESH_CYCLES

uint8_t REMOTE_REFRESH_CYCLES { 5 }
inlineconstexpr

send a refresh every N mains cycles

Definition at line 36 of file remote_loads_core.h.