23#ifndef OVERRIDE_MASKS_H
24#define OVERRIDE_MASKS_H
60template<
typename Pins,
typename IsActive >
71 uint8_t
i{ pins.size() };
75 if (isActive(pins.getPin(
i)))
77 masks.local |= pins.getLocalBitmask(
i);
78 masks.remote |= pins.getRemoteBitmask(
i);
100template<
typename ReadBoost >
102 const int16_t threshold_x100,
const uint8_t count, ReadBoost
readBoost)
109 if (temperature_x100 > threshold_x100)
115 for (uint8_t
i = 0;
i != count; ++
i)
117 const DualTariff::Boost boost{
readBoost(
i) };
119 if (DualTariff::inWindow(elapsed, boost.start, boost.end))
121 forcing.local |= boost.local;
122 forcing.remote |= boost.remote;
DualTariff::Boost readBoost(const uint8_t i)
Reads scheduled boost i from flash.
OverrideMasks boostForcing(const bool bOffPeak, const uint32_t elapsed, const int16_t temperature_x100, const int16_t threshold_x100, const uint8_t count, ReadBoost readBoost)
The targets of the scheduled boosts whose window is open.
OverrideMasks pinForcing(const Pins &pins, IsActive isActive)
The targets of the override pins that are active (held LOW).
constexpr OverrideMasks operator|(const OverrideMasks &a, const OverrideMasks &b)
Both masks of a and b: what either forces.
Holds both local and remote override bitmasks.
Some utility functions for dual tariff feature.