Skip to content

Commit

Permalink
5 loads
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed Aug 24, 2024
1 parent 0b00ed9 commit a0f2c28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
14 changes: 5 additions & 9 deletions Mk2_3phase_RFdatalog_temp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//--------------------------------------------------------------------------------------------------
// constants which must be set individually for each system
//
inline constexpr uint8_t NO_OF_DUMPLOADS{ 2 }; /**< number of dump loads connected to the diverter */
inline constexpr uint8_t NO_OF_DUMPLOADS{ 5 }; /**< number of dump loads connected to the diverter */

#ifdef EMONESP
inline constexpr bool EMONESP_CONTROL{ true };
Expand All @@ -50,7 +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 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 All @@ -71,8 +71,8 @@ inline constexpr bool DUAL_TARIFF{ false }; /**< set it to 'true' if th
// D12 is MISO
// D13 is SCK

inline constexpr uint8_t physicalLoadPin[NO_OF_DUMPLOADS]{ 5, 7 }; /**< for 3-phase PCB, Load #1/#2/#3 (Rev 2 PCB) */
inline constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]{ 0, 1 }; /**< load priorities and states at startup */
inline constexpr uint8_t physicalLoadPin[NO_OF_DUMPLOADS]{ 5, 6, 7, 8, 9 }; /**< for 3-phase PCB, Load #1/#2/#3 (Rev 2 PCB) */
inline constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]{ 0, 1, 2, 3, 4 }; /**< load priorities and states at startup */

// Set the value to 0xff when the pin is not needed (feature deactivated)
inline constexpr uint8_t dualTariffPin{ 0xff }; /**< for 3-phase PCB, off-peak trigger */
Expand All @@ -89,11 +89,7 @@ inline constexpr pairForceLoad rg_ForceLoad[NO_OF_DUMPLOADS]{ { -3, 2 } }; /**<
inline constexpr int16_t iTemperatureThreshold{ 100 }; /**< the temperature threshold to stop overriding in °C */

inline constexpr TemperatureSensing temperatureSensing{ 0xff,
{ { 0x28, 0xBE, 0x41, 0x6B, 0x09, 0x00, 0x00, 0xA4 },
{ 0x28, 0xED, 0x5B, 0x6A, 0x09, 0x00, 0x00, 0x9D },
{ 0x28, 0xDB, 0x6D, 0x6A, 0x09, 0x00, 0x00, 0xDA },
{ 0x28, 0x59, 0x1F, 0x6A, 0x09, 0x00, 0x00, 0xB0 },
{ 0x28, 0x1B, 0xD7, 0x6A, 0x09, 0x00, 0x00, 0xB7 } } }; /**< list of temperature sensor Addresses */
{ { 0x28, 0x1B, 0xD7, 0x6A, 0x09, 0x00, 0x00, 0xB7 } } }; /**< list of temperature sensor Addresses */

inline constexpr uint32_t ROTATION_AFTER_CYCLES{ 8UL * 3600UL * SUPPLY_FREQUENCY }; /**< rotates load priorities after this period of inactivity */

Expand Down
5 changes: 3 additions & 2 deletions Mk2_3phase_RFdatalog_temp/config_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ inline constexpr uint8_t NO_OF_PHASES{ 3 }; /**< number of phases of the main su

//--------------------------------------------------------------------------------------------------
// for users with zero-export profile, this value will be negative
inline constexpr int16_t REQUIRED_EXPORT_IN_WATTS{ 20 }; /**< when set to a negative value, this acts as a PV generator */
inline constexpr int16_t REQUIRED_EXPORT_IN_WATTS{ 0 }; /**< when set to a negative value, this acts as a PV generator */

//--------------------------------------------------------------------------------------------------
// other system constants, should match most of installations
inline constexpr uint8_t SUPPLY_FREQUENCY{ 50 }; /**< number of cycles/s of the grid power supply */

inline constexpr uint8_t DATALOG_PERIOD_IN_SECONDS{ 5 }; /**< Period of datalogging in seconds */
inline constexpr uint8_t DATALOG_PERIOD_IN_SECONDS{ 5 }; /**< Period of datalogging in seconds */

inline constexpr typename conditional< DATALOG_PERIOD_IN_SECONDS * SUPPLY_FREQUENCY >= UINT8_MAX, uint16_t, uint8_t >::type DATALOG_PERIOD_IN_MAINS_CYCLES{ DATALOG_PERIOD_IN_SECONDS * SUPPLY_FREQUENCY }; /**< Period of datalogging in cycles */

// Computes inverse value at compile time to use '*' instead of '/'
Expand Down
2 changes: 1 addition & 1 deletion Mk2_3phase_RFdatalog_temp/processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ float f_upperEnergyThreshold; /**< dynamic upper threshold */
// for improved control of multiple loads
bool b_recentTransition{ false }; /**< a load state has been recently toggled */
uint8_t postTransitionCount; /**< counts the number of cycle since last transition */
constexpr uint8_t POST_TRANSITION_MAX_COUNT{ 3 }; /**< allows each transition to take effect */
constexpr uint8_t POST_TRANSITION_MAX_COUNT{ 2 }; /**< allows each transition to take effect */
// constexpr uint8_t POST_TRANSITION_MAX_COUNT{50}; /**< for testing only */
uint8_t activeLoad{ NO_OF_DUMPLOADS }; /**< current active load */

Expand Down

0 comments on commit a0f2c28

Please sign in to comment.