3-phase PV router
Loading...
Searching...
No Matches
TempSchedule::Scheduler< N, CONVERSION_CYCLES > Class Template Reference

The round of the sensors, one transaction per mains cycle. More...

#include <temp_schedule.h>

Public Member Functions

bool done () const
 Whether the round is over.
 
bool newPeriod ()
 A datalog period begins: a new round, once this one is over.
 
Action next (const bool onTime)
 The transaction of this mains cycle: called once per cycle, when the loop sees it.
 
void skipRestOf (const uint8_t idx)
 The sensor did not answer its ADDRESS: its other transactions are skipped.
 

Private Attributes

bool converting { false }
 
uint8_t sensor { 0 }
 
uint16_t sinceConvert { 0 }
 
uint8_t sub { 0 }
 

Detailed Description

template<uint8_t N, uint16_t CONVERSION_CYCLES>
class TempSchedule::Scheduler< N, CONVERSION_CYCLES >

The round of the sensors, one transaction per mains cycle.

Main-loop code. The state is two small counters, the sensor and its transaction, advanced by compare and reset: no division at run time (the divisions above are compile-time only).

Template Parameters
NThe number of sensors
CONVERSION_CYCLESconversionCycles(SUPPLY_FREQUENCY)

Definition at line 129 of file temp_schedule.h.

Member Function Documentation

◆ done()

template<uint8_t N, uint16_t CONVERSION_CYCLES>
bool TempSchedule::Scheduler< N, CONVERSION_CYCLES >::done ( ) const
inline

Whether the round is over.

Definition at line 222 of file temp_schedule.h.

Here is the caller graph for this function:

◆ newPeriod()

template<uint8_t N, uint16_t CONVERSION_CYCLES>
bool TempSchedule::Scheduler< N, CONVERSION_CYCLES >::newPeriod ( )
inline

A datalog period begins: a new round, once this one is over.

An unfinished round (only after many late cycles) goes on: the sensors it has not read yet keep the values of the period before.

Returns
true if a new round starts: its conversion can run at once, in the cycle that ends the period (which had no transaction, the round being over)

Definition at line 209 of file temp_schedule.h.

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

◆ next()

template<uint8_t N, uint16_t CONVERSION_CYCLES>
Action TempSchedule::Scheduler< N, CONVERSION_CYCLES >::next ( const bool onTime)
inline

The transaction of this mains cycle: called once per cycle, when the loop sees it.

Parameters
onTimeWhether the cycle was seen on time (the loop idle when it began)
Returns
The transaction to run now, Step::NONE for none

Definition at line 145 of file temp_schedule.h.

Here is the caller graph for this function:

◆ skipRestOf()

template<uint8_t N, uint16_t CONVERSION_CYCLES>
void TempSchedule::Scheduler< N, CONVERSION_CYCLES >::skipRestOf ( const uint8_t idx)
inline

The sensor did not answer its ADDRESS: its other transactions are skipped.

Parameters
idxThe sensor of the last ADDRESS (another one is ignored)

Definition at line 191 of file temp_schedule.h.

Here is the caller graph for this function:

Member Data Documentation

◆ converting

template<uint8_t N, uint16_t CONVERSION_CYCLES>
bool TempSchedule::Scheduler< N, CONVERSION_CYCLES >::converting { false }
private

the round's conversion has started

Definition at line 133 of file temp_schedule.h.

◆ sensor

template<uint8_t N, uint16_t CONVERSION_CYCLES>
uint8_t TempSchedule::Scheduler< N, CONVERSION_CYCLES >::sensor { 0 }
private

the sensor being read; N: round over

Definition at line 135 of file temp_schedule.h.

◆ sinceConvert

template<uint8_t N, uint16_t CONVERSION_CYCLES>
uint16_t TempSchedule::Scheduler< N, CONVERSION_CYCLES >::sinceConvert { 0 }
private

cycles since it started, up to CONVERSION_CYCLES

Definition at line 134 of file temp_schedule.h.

◆ sub

template<uint8_t N, uint16_t CONVERSION_CYCLES>
uint8_t TempSchedule::Scheduler< N, CONVERSION_CYCLES >::sub { 0 }
private

its next transaction: 0 ADDRESS, 1 READ, 2 CLOSE

Definition at line 136 of file temp_schedule.h.


The documentation for this class was generated from the following file: