48#ifndef TEMP_SCHEDULE_H
49#define TEMP_SCHEDULE_H
86 return static_cast< uint16_t
>((
static_cast< uint32_t
>(
CONVERSION_MS) * supplyFrequency + 999) / 1000 + 1);
95constexpr uint16_t
roundCycles(
const uint8_t noOfSensors,
const uint8_t supplyFrequency)
112constexpr bool fitsInPeriod(
const uint8_t noOfSensors,
const uint8_t supplyFrequency,
const uint16_t periodCycles)
114 const uint32_t cycles{
roundCycles(noOfSensors, supplyFrequency) };
115 return cycles + cycles / supplyFrequency + 2 <= periodCycles;
128template< u
int8_t N, u
int16_t CONVERSION_CYCLES >
131 static_assert(N > 0,
"no sensor");
The round of the sensors, one transaction per mains cycle.
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.
constexpr uint16_t conversionCycles(const uint8_t supplyFrequency)
The mains cycles from the conversion to the first read.
constexpr uint16_t roundCycles(const uint8_t noOfSensors, const uint8_t supplyFrequency)
The mains cycles of a round on time: from the conversion to the last CLOSE.
Step
The 1-Wire transaction of a mains cycle.
constexpr bool fitsInPeriod(const uint8_t noOfSensors, const uint8_t supplyFrequency, const uint16_t periodCycles)
Whether a round ends within its datalog period.
constexpr uint8_t STEPS_PER_SENSOR
constexpr uint16_t CONVERSION_MS
The transaction to run, and the sensor it reads (ADDRESS, READ, CLOSE).