Skip to content

Commit

Permalink
Next step
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed May 2, 2023
1 parent 405e9c3 commit 09a8647
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Mk2_3phase_RFdatalog_temp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ inline constexpr bool OVERRIDE_PIN_PRESENT{ false }; /**< set
#endif

inline constexpr bool WATCHDOG_PIN_PRESENT{ false }; /**< set it to 'true' if there's a watch led */
inline constexpr bool RELAY_DIVERSION{ false }; /**< set it to 'true' if a relay is used for diversion */
inline constexpr bool DUAL_TARIFF{ false }; /**< set it to 'true' if there's a dual tariff each day AND the router is connected to the billing meter */

// ----------- Pinout assignments -----------
Expand Down Expand Up @@ -82,7 +83,7 @@ inline constexpr uint8_t watchDogPin{ 0xff }; /**<

inline constexpr uint8_t tempSensorPin{ 0xff }; /**< for 3-phase PCB, sensor pin */

inline constexpr relayConfig relay_Config; /**< config for relay diversion */
inline constexpr relayConfig relay_Config; /**< config for relay diversion, see class definition for defaults */

inline constexpr uint8_t ul_OFF_PEAK_DURATION{ 8 }; /**< Duration of the off-peak period in hours */
inline constexpr pairForceLoad rg_ForceLoad[NO_OF_DUMPLOADS]{ { -3, 2 } }; /**< force config for load #1 ONLY for dual tariff */
Expand Down
6 changes: 3 additions & 3 deletions Mk2_3phase_RFdatalog_temp/utils_relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @brief Config parameters for relay diversion
*
*/
class relayConfig
template< uint8_t T = 1 > class relayConfig
{
public:
constexpr relayConfig() = default;
Expand All @@ -39,8 +39,8 @@ class relayConfig
*
* @param _surplusThreshold Surplus threshold to turn relay ON
* @param _importThreshold Import threshold to turn relay OFF
* @param _minON Minimum duration to leave relay ON
* @param _minOFF Minimum duration in minutes to l
* @param _minON Minimum duration in minutes to leave relay ON
* @param _minOFF Minimum duration in minutes to leave relay OFF
*/
constexpr relayConfig(int16_t _surplusThreshold, int16_t _importThreshold, uint16_t _minON, uint16_t _minOFF)
: surplusThreshold(abs(_surplusThreshold)), importThreshold(abs(_importThreshold)), minON(_minON * 60), minOFF(_minOFF * 60)
Expand Down
2 changes: 2 additions & 0 deletions Mk2_3phase_RFdatalog_temp/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ static_assert((PRIORITY_ROTATION == RotationModes::PIN) ^ (rotationPin == 0xff),
static_assert(OVERRIDE_PIN_PRESENT ^ (forcePin == 0xff), "******** Wrong pin value for override command. Please check your config.h ! ********");
static_assert(WATCHDOG_PIN_PRESENT ^ (watchDogPin == 0xff), "******** Wrong pin value for watchdog. Please check your config.h ! ********");

static_assert(RELAY_DIVERSION ^ (relayPin == 0xff), "******** Wrong pin value for relay diversion. Please check your config.h ! ********");

static_assert(DUAL_TARIFF ^ (dualTariffPin == 0xff), "******** Wrong pin value for dual tariff. Please check your config.h ! ********");
static_assert(!DUAL_TARIFF | (ul_OFF_PEAK_DURATION == 0), "******** Off-peak duration cannot be zero. Please check your config.h ! ********");
static_assert(!(DUAL_TARIFF & (ul_OFF_PEAK_DURATION > 12)), "******** Off-peak duration cannot last more than 12 hours. Please check your config.h ! ********");
Expand Down

0 comments on commit 09a8647

Please sign in to comment.