3-phase PV router
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
11
12#ifndef CONFIG_H
13#define CONFIG_H
14
15//--------------------------------------------------------------------------------------------------
16//#define RF_PRESENT /**< this line must be commented out if the RFM12B module is not present */#define ENABLE_DEBUG /**< enable this line to include debugging print statements */
17#define ENABLE_DEBUG
18//--------------------------------------------------------------------------------------------------
19
20#include "config_system.h"
21#include "debug.h"
22#include "types.h"
23
24#include "utils_dualtariff.h"
25#include "utils_relay.h"
26
28
29//--------------------------------------------------------------------------------------------------
30// constants which must be set individually for each system
31//
32inline constexpr uint8_t NO_OF_DUMPLOADS{ 2 };
33
34inline constexpr bool EMONESP_CONTROL{ false };
35inline constexpr bool DIVERSION_PIN_PRESENT{ false };
36inline constexpr RotationModes PRIORITY_ROTATION{ RotationModes::OFF };
37inline constexpr bool OVERRIDE_PIN_PRESENT{ false };
38
39inline constexpr bool WATCHDOG_PIN_PRESENT{ false };
40inline constexpr bool RELAY_DIVERSION{ false };
41inline constexpr bool DUAL_TARIFF{ false };
42inline constexpr bool TEMP_SENSOR_PRESENT{ false };
43
44#include "utils_temp.h"
45
46// ----------- Pinout Assignments -----------
47//
48// ANALOG pins:
49// - All analog pins are reserved and hard-wired on the PCB.
50//
51// DIGITAL pins:
52// - D0 & D1: Reserved for the Serial interface.
53//
54// RFM12B Module (if present):
55// - D2: Used for the RFM12B module.
56// - D10: Used for the RFM12B module.
57// - D11: Used for the RFM12B module.
58// - D12: Used for the RFM12B module.
59// - D13: Used for the RFM12B module.
60//
61// SPI Interface:
62// - D10: Chip Select (CS).
63// - D11: Master Out Slave In (MOSI).
64// - D12: Master In Slave Out (MISO).
65// - D13: Serial Clock (SCK).
66//
67// Expansion Board:
68// Digital Input Pins (D10-D13) are wired to the expansion board and it's intended
69// to configure them as digital inputs
70// They allow external control from Home Assistant for functions such as:
71// * Forced operation mode
72// * Diversion enable/disable
73// * Priority rotation triggering
74// * Manual load control
75//
76// D3 is wired to the expansion board too and is intended for taking control of the temperature sensor.
77//
78// Note: When using these pins for Home Assistant integration, ensure the ESP32
79// counterpart is properly configured to send the appropriate signals.
80
81inline constexpr uint8_t physicalLoadPin[NO_OF_DUMPLOADS]{ 5, 7 };
82inline constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]{ 0, 1 };
83
84// Set the value to 'unused_pin' when the pin is not needed (feature deactivated)
85inline constexpr uint8_t dualTariffPin{ unused_pin };
86inline constexpr uint8_t diversionPin{ unused_pin };
87inline constexpr uint8_t rotationPin{ unused_pin };
88inline constexpr uint8_t forcePin{ unused_pin };
89inline constexpr uint8_t watchDogPin{ unused_pin };
90
91inline constexpr RelayEngine relays{ { { unused_pin, 1000, 200, 1, 1 } } };
92
93inline constexpr uint8_t ul_OFF_PEAK_DURATION{ 8 };
94inline constexpr pairForceLoad rg_ForceLoad[NO_OF_DUMPLOADS]{ { -3, 2 } };
95
96inline constexpr int16_t iTemperatureThreshold{ 100 };
97
99 { { 0x28, 0xBE, 0x41, 0x6B, 0x09, 0x00, 0x00, 0xA4 },
100 { 0x28, 0xED, 0x5B, 0x6A, 0x09, 0x00, 0x00, 0x9D },
101 { 0x28, 0xDB, 0x6D, 0x6A, 0x09, 0x00, 0x00, 0xDA },
102 { 0x28, 0x59, 0x1F, 0x6A, 0x09, 0x00, 0x00, 0xB0 },
103 { 0x28, 0x1B, 0xD7, 0x6A, 0x09, 0x00, 0x00, 0xB7 } } };
104
105inline constexpr uint32_t ROTATION_AFTER_SECONDS{ 8UL * 3600UL };
106
107/* --------------------------------------
108 RF configuration (for the RFM12B module)
109 frequency options are RF12_433MHZ, RF12_868MHZ or RF12_915MHZ
110*/
111#ifdef RF_PRESENT
112
113#define RF69_COMPAT 0 // for the RFM12B
114// #define RF69_COMPAT 1 // for the RF69
115
116#define FREQ RF12_868MHZ
117
118inline constexpr int nodeID{ 10 };
119inline constexpr int networkGroup{ 210 };
120inline constexpr int UNO{ 1 };
121
122#endif // RF_PRESENT
123
124#endif // CONFIG_H
Manages a collection of relays and their behavior based on surplus and import thresholds.
Implements temperature sensing functionality for multiple sensors.
Definition utils_temp.h:106
Config parameters for overriding a load.
constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]
Definition config.h:82
constexpr bool RELAY_DIVERSION
Definition config.h:40
constexpr int networkGroup
Definition config.h:119
constexpr pairForceLoad rg_ForceLoad[NO_OF_DUMPLOADS]
Definition config.h:94
constexpr bool OVERRIDE_PIN_PRESENT
Definition config.h:37
constexpr uint32_t ROTATION_AFTER_SECONDS
Definition config.h:105
constexpr uint8_t dualTariffPin
Definition config.h:85
constexpr TemperatureSensing temperatureSensing
Definition config.h:98
constexpr uint8_t forcePin
Definition config.h:88
constexpr RelayEngine relays
Definition config.h:91
constexpr uint8_t physicalLoadPin[NO_OF_DUMPLOADS]
Definition config.h:81
constexpr int nodeID
Definition config.h:118
constexpr bool DUAL_TARIFF
Definition config.h:41
constexpr uint8_t diversionPin
Definition config.h:86
constexpr int UNO
Definition config.h:120
constexpr SerialOutputType SERIAL_OUTPUT_TYPE
Definition config.h:27
constexpr bool EMONESP_CONTROL
Definition config.h:34
constexpr uint8_t NO_OF_DUMPLOADS
Definition config.h:32
constexpr uint8_t ul_OFF_PEAK_DURATION
Definition config.h:93
constexpr bool TEMP_SENSOR_PRESENT
Definition config.h:42
constexpr int16_t iTemperatureThreshold
Definition config.h:96
constexpr bool WATCHDOG_PIN_PRESENT
Definition config.h:39
constexpr bool DIVERSION_PIN_PRESENT
Definition config.h:35
constexpr uint8_t rotationPin
Definition config.h:87
constexpr uint8_t watchDogPin
Definition config.h:89
Basic configuration values to be set by the end-user.
Some macro for the Serial Output and Debugging.
Some basics classes/types.
RotationModes
Definition types.h:60
SerialOutputType
Definition types.h:27
Some utility functions for dual tariff feature.
constexpr uint8_t unused_pin
Definition utils_pins.h:17
Some utility functions for the relay output feature.
Provides utilities for managing temperature sensors.