Commit 6f1fbc5c30f98ee3f14d5fba1150ac223d4917e6

Authored by Jeroen88
1 parent f1fb1a21

Rename to primary and secondary regarding thermostat and remote device like boiler or HVAC

src/EasyOpenTherm.cpp
... ... @@ -28,8 +28,8 @@
28 28 OpenTherm::OpenTherm(uint8_t rxPin,
29 29 uint8_t txPin,
30 30 time_t timeoutMs,
31   - bool master): _rxPin(rxPin), _txPin(txPin), _timeoutMs(timeoutMs), _master(master) {
32   - _OTP = new OTPhysicalLayer(_rxPin, _txPin, master);
  31 + bool primary): _rxPin(rxPin), _txPin(txPin), _timeoutMs(timeoutMs), _primary(primary) {
  32 + _OTP = new OTPhysicalLayer(_rxPin, _txPin, primary);
33 33  
34 34 if(!_OTP) Serial.println("OpenTherm Out of Memory, fail on assert()");
35 35 assert(_OTP != NULL); // check for Out of Memory
... ... @@ -41,24 +41,24 @@
41 41 }
42 42  
43 43  
44   -bool OpenTherm::status(uint8_t & slaveFlags) {
45   - uint8_t masterFlags = uint8_t(OpenTherm::STATUS_FLAGS::MASTER_CH_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::MASTER_DHW_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::MASTER_COOLING_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::MASTER_OTC_ENABLE);
  44 +bool OpenTherm::status(uint8_t & secondaryFlags) {
  45 + uint8_t primaryFlags = uint8_t(OpenTherm::STATUS_FLAGS::PRIMARY_CH_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::PRIMARY_DHW_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::PRIMARY_COOLING_ENABLE) | uint8_t(OpenTherm::STATUS_FLAGS::PRIMARY_OTC_ENABLE);
46 46  
47   - return status(masterFlags, slaveFlags);
  47 + return status(primaryFlags, secondaryFlags);
48 48 }
49 49  
50 50  
51   -bool OpenTherm::status(uint8_t masterFlags,
52   - uint8_t & slaveFlags) {
53   - slaveFlags = 0x00; // See OpenTherm Protocol Specification v2.2 page 25
54   - return readWrite(READ_WRITE_DATA_ID::STATUS, masterFlags, slaveFlags);
  51 +bool OpenTherm::status(uint8_t primaryFlags,
  52 + uint8_t & secondaryFlags) {
  53 + secondaryFlags = 0x00; // See OpenTherm Protocol Specification v2.2 page 25
  54 + return readWrite(READ_WRITE_DATA_ID::STATUS, primaryFlags, secondaryFlags);
55 55 }
56 56  
57 57  
58 58 bool OpenTherm::read(READ_DATA_ID msgID,
59 59 uint16_t & value) {
60 60 OTDataLinkLayer data;
61   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), 0x0000);
  61 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), 0x0000);
62 62  
63 63 if(_execute(data)) {
64 64 value = data.value();
... ... @@ -73,7 +73,7 @@ bool OpenTherm::read(READ_DATA_ID ms
73 73 bool OpenTherm::read(READ_DATA_ID msgID,
74 74 int16_t & value) { // signed integer
75 75 OTDataLinkLayer data;
76   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), 0x0000);
  76 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), 0x0000);
77 77  
78 78 if(_execute(data)) {
79 79 value = int16_t(data.value());
... ... @@ -89,7 +89,7 @@ bool OpenTherm::read(READ_DATA_ID ms
89 89 uint8_t & valueMSB,
90 90 uint8_t & valueLSB) {
91 91 OTDataLinkLayer data;
92   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), 0x0000);
  92 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), 0x0000);
93 93  
94 94 if(_execute(data)) {
95 95 valueMSB = data.valueMSB();
... ... @@ -106,7 +106,7 @@ bool OpenTherm::read(READ_DATA_ID ms
106 106 int8_t & valueMSB, // signed intergers
107 107 int8_t & valueLSB) {
108 108 OTDataLinkLayer data;
109   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), 0x0000);
  109 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), 0x0000);
110 110  
111 111 if(_execute(data)) {
112 112 valueMSB = int8_t(data.valueMSB());
... ... @@ -122,7 +122,7 @@ bool OpenTherm::read(READ_DATA_ID ms
122 122 bool OpenTherm::read(READ_DATA_ID msgID,
123 123 float & value) {
124 124 OTDataLinkLayer data;
125   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), 0x0000);
  125 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), 0x0000);
126 126  
127 127 if(_execute(data)) {
128 128 value = float(data.value()) / 256.0;
... ... @@ -137,7 +137,7 @@ bool OpenTherm::read(READ_DATA_ID ms
137 137 bool OpenTherm::write(WRITE_DATA_ID msgID,
138 138 uint16_t value) {
139 139 OTDataLinkLayer data;
140   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_WRITE_DATA, uint8_t(msgID), value);
  140 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_WRITE_DATA, uint8_t(msgID), value);
141 141  
142 142 return _execute(data);
143 143 }
... ... @@ -147,7 +147,7 @@ bool OpenTherm::write(WRITE_DATA_ID ms
147 147 uint8_t valueMSB,
148 148 uint8_t valueLSB) {
149 149 OTDataLinkLayer data;
150   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_WRITE_DATA, uint8_t(msgID), valueMSB, valueLSB);
  150 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_WRITE_DATA, uint8_t(msgID), valueMSB, valueLSB);
151 151  
152 152 return _execute(data);
153 153 }
... ... @@ -156,7 +156,7 @@ bool OpenTherm::write(WRITE_DATA_ID ms
156 156 bool OpenTherm::write(WRITE_DATA_ID msgID,
157 157 float value) {
158 158 OTDataLinkLayer data;
159   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_WRITE_DATA, uint8_t(msgID), uint16_t(value * 256.0f));
  159 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_WRITE_DATA, uint8_t(msgID), uint16_t(value * 256.0f));
160 160  
161 161 return _execute(data);
162 162 }
... ... @@ -166,7 +166,7 @@ bool OpenTherm::readWrite(READ_WRITE_DATA_ID ms
166 166 uint8_t valueMSB,
167 167 uint8_t & valueLSB) {
168 168 OTDataLinkLayer data;
169   - data.set(OTDataLinkLayer::MSG_TYPE::MASTER_TO_SLAVE_READ_DATA, uint8_t(msgID), valueMSB, valueLSB);
  169 + data.set(OTDataLinkLayer::MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA, uint8_t(msgID), valueMSB, valueLSB);
170 170  
171 171 if(_execute(data)) {
172 172 valueLSB = data.valueLSB();
... ... @@ -298,17 +298,17 @@ uint32_t OTDataLinkLayer::frame() {
298 298  
299 299  
300 300 bool OTDataLinkLayer::isValid() {
301   - return parity() && (type() == MSG_TYPE::SLAVE_TO_MASTER_READ_ACK || type() == MSG_TYPE::SLAVE_TO_MASTER_WRITE_ACK || type() == MSG_TYPE::MASTER_TO_SLAVE_READ_DATA || type() == MSG_TYPE::MASTER_TO_SLAVE_WRITE_DATA);
  301 + return parity() && (type() == MSG_TYPE::SECONDARY_TO_PRIMARY_READ_ACK || type() == MSG_TYPE::SECONDARY_TO_PRIMARY_WRITE_ACK || type() == MSG_TYPE::PRIMARY_TO_SECONDARY_READ_DATA || type() == MSG_TYPE::PRIMARY_TO_SECONDARY_WRITE_DATA);
302 302 }
303 303  
304 304  
305 305 bool OTDataLinkLayer::dataInvalid() {
306   - return type() == MSG_TYPE::SLAVE_TO_MASTER_DATA_INVALID || type() == MSG_TYPE::MASTER_TO_SLAVE_INVALID_DATA;
  306 + return type() == MSG_TYPE::SECONDARY_TO_PRIMARY_DATA_INVALID || type() == MSG_TYPE::PRIMARY_TO_SECONDARY_INVALID_DATA;
307 307 }
308 308  
309 309  
310 310 bool OTDataLinkLayer::unknownDataID() {
311   - return type() == MSG_TYPE::SLAVE_TO_MASTER_UNKNOWN_DATA_ID; // Slave does not select the DATA-ID, this function should not be called from a slave
  311 + return type() == MSG_TYPE::SECONDARY_TO_PRIMARY_UNKNOWN_DATA_ID; // Secondary device does not select the DATA-ID, this function should not be called from a secondary
312 312 }
313 313  
314 314  
... ... @@ -340,7 +340,7 @@ void OTPGenericISR() {
340 340  
341 341 OTPhysicalLayer::OTPhysicalLayer(uint8_t rxPin,
342 342 uint8_t txPin,
343   - bool master): _rxPin(rxPin), _txPin(txPin), _master(master) {
  343 + bool primary): _rxPin(rxPin), _txPin(txPin), _primary(primary) {
344 344  
345 345 pinMode(_rxPin, INPUT);
346 346 pinMode(_txPin, OUTPUT);
... ... @@ -398,7 +398,7 @@ bool OTPhysicalLayer::receive(uint32_t & fr
398 398 if(_state == STATE::INVALID) return false; // ::send() will set _state to STATE::WAITING
399 399  
400 400 if(_state != STATE::READY) { // ::handleInterrupt() will set _state to STATE::READY upon receiving a complete frame (including start and stop bits)
401   - if(_master && millis() - _lastSentTimestampMs > 800) { // ::send() will set _lastSentTimestampMs to after sending the final bit. A slave never times out, it keeps on listning to the master
  401 + if(_primary && millis() - _lastSentTimestampMs > 800) { // ::send() will set _lastSentTimestampMs to after sending the final bit. A secondary never times out, it keeps on listning to the primary
402 402 _state = STATE::INVALID; // timeout
403 403 }
404 404  
... ... @@ -431,12 +431,12 @@ void OTPhysicalLayer::sendBit(uint8_t va
431 431 if(_state == STATE::INVALID) return; // Start reception after _send() has set _state to STATE::WAITING
432 432 // ::handleInterrupt() passes from STATE_WATING to STATE::START_BIT, to STATE::RECEIVING for the data bits, to _state STATE::READY after the stop bit
433 433 if(_state == STATE::READY) {
434   - if(!_master && digitalRead(_rxPin) == HIGH) {
  434 + if(!_primary && digitalRead(_rxPin) == HIGH) {
435 435 _state = STATE::WAITING;
436 436 _frame = 0;
437 437 } else {
438 438  
439   - return; // Nothing to do for a master in _state is STATE::READY
  439 + return; // Nothing to do for a primary device in _state is STATE::READY
440 440 }
441 441 }
442 442  
... ...
src/EasyOpenTherm.h
... ... @@ -17,6 +17,9 @@
17 17 *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20 + *
  21 + * Primary: thermostat
  22 + * Secondary: boiler or HVAC
20 23 */
21 24  
22 25  
... ... @@ -34,19 +37,19 @@ public:
34 37 OpenTherm(uint8_t rxPin,
35 38 uint8_t txPin,
36 39 time_t timeoutMs = 900,
37   - bool master = true);
  40 + bool primary = true);
38 41  
39 42 ~OpenTherm();
40 43  
41   - bool status(uint8_t & slaveFlags);
  44 + bool status(uint8_t & secondaryFlags);
42 45  
43   - bool status(uint8_t masterFlags,
44   - uint8_t & slaveFlags);
  46 + bool status(uint8_t primaryFlags,
  47 + uint8_t & secondaryFlags);
45 48  
46 49  
47 50 enum class READ_WRITE_DATA_ID {
48 51 // Class 1 : Control and Status Information
49   - STATUS = 0, // flag8, flag8 Mandatory: Master status, slave status
  52 + STATUS = 0, // flag8, flag8 Mandatory; Primary status, secondary status
50 53  
51 54 // Class 3 : Remote Commands
52 55 COMMAND_CODE = 4, // u8, u8 Command code / Response to command
... ... @@ -55,10 +58,10 @@ public:
55 58 // Where applicable and available flags and masks are also defined below
56 59  
57 60 // HVAC specific DATA-IDs (ventilation / heat recovery)
58   - HVAC_STATUS = 70, // flag8, flag8 Master status, slave status
  61 + HVAC_STATUS = 70, // flag8, flag8 Primary status, secondary status
59 62  
60 63 // Solar specific DATA-IDs
61   - SOLAR_STATUS = 101, // flag8, flag8? MSB Master Solar Storage Mode, LSB Slave Solar Storage Mode
  64 + SOLAR_STATUS = 101, // flag8, flag8? MSB Primary Solar Storage Mode, LSB Secondary Solar Storage Mode
62 65 };
63 66  
64 67  
... ... @@ -68,18 +71,18 @@ public:
68 71 OEM_DIAGNOSTIC = 115, // u16 An OEM-specific diagnostic/service code
69 72  
70 73 // Class 2 : Configuration Information
71   - SLAVE_CONFIGURATION = 3, // flag8, u8 Mandatory: Slave Configuration Flags / MemberID Code of the slave
72   - OPENTHERM_VERSION_SLAVE = 125, // f8.8 The implemented version of the OpenTherm Protocol Specification in the slave
73   - SLAVE_PRODUCT_VERSION = 127, // u8, u8 The slave device product version number and type as defined by the manufacturer
  74 + SECONDARY_CONFIGURATION = 3, // flag8, u8 Mandatory; Secondary Configuration Flags / MemberID Code of the secondary device
  75 + OPENTHERM_VERSION_SECONDARY = 125, // f8.8 The implemented version of the OpenTherm Protocol Specification in the secondary device
  76 + SECONDARY_PRODUCT_VERSION = 127, // u8, u8 The secondary device product version number and type as defined by the manufacturer
74 77  
75 78 // Class 4 : Sensor and Informational Data
76   - RELATIVE_MODULATION_LEVEL = 17, // f8.8 Mandatory: Percent modulation between min and max modulation levels. i.e. 0% = Minimum modulation level and 100% = Maximum modulation level (%)
  79 + RELATIVE_MODULATION_LEVEL = 17, // f8.8 Mandatory; Percent modulation between min and max modulation levels. i.e. 0% = Minimum modulation level and 100% = Maximum modulation level (%)
77 80 CH_WATER_PRESSURE = 18, // f8.8 Water pressure of the boiler CH circuit (bar)
78 81 DHW_FLOW_RATE = 19, // f8.8 Water flow rate through the DHW circuit (l/min)
79 82 DAY_TIME = 20, // special, u8 Day of Week and Time of Day; special: bit 7,6,5 day of week (1=Monday, etc...., 0=no DoW info available); bit 4,3,2,1,0 hours, LSB is minutes
80 83 DATE = 21, // u8, u8 Calendar date: Month, Day of month
81 84 YEAR = 22, // u16 Calendar year; note : 1999-2099 will normally be sufficient
82   - BOILER_WATER_TEMP = 25, // f8.8 Mandatory: Flow water temperature from boiler (ยฐC)
  85 + BOILER_WATER_TEMP = 25, // f8.8 Mandatory; Flow water temperature from boiler (ยฐC)
83 86 DHW_TEMPERATURE = 26, // f8.8 Domestic hot water temperature (ยฐC)
84 87 OUTSIDE_TEMPERATURE = 27, // f8.8 Outside air temperature (ยฐC)
85 88 RETURN_WATER_TEMPERATURE = 28, // f8.8 Return water temperature to boiler (ยฐC)
... ... @@ -88,26 +91,26 @@ public:
88 91 FLOW_TEMPERATURE_CH2 = 31, // f8.8 Flow water temperature of the second central heating circuit (ยฐC)
89 92 DHW2_TEMPERATURE = 32, // f8.8 Domestic hot water temperature 2 (ยฐC)
90 93 EXHAUST_TEMPERATURE = 33, // s16 Exhaust temperature (ยฐC)
91   - BURNER_STARTS = 116, // u16 Number of starts burner. Reset by writing zero is optional for slave
92   - CH_PUMP_STARTS = 117, // u16 Number of starts CH pump. Reset by writing zero is optional for slave
93   - DHW_PUMP_VALVE_STARTS = 118, // u16 Number of starts DHW pump/valve. Reset by writing zero is optional for slave
94   - DHW_BURNER_STARTS = 119, // u16 Number of starts burner in DHW mode. Reset by writing zero is optional for slave
95   - BURNER_OPERATION_HOURS = 120, // u16 Number of hours that burner is in operation (i.e. flame on). Reset by writing zero is optional for slave
96   - CH_PUMP_OPERATION_HOURS = 121, // u16 Number of hours that CH pump has been running. Reset by writing zero is optional for slave
97   - DHW_PUMP_VALVE_OPERATION_HOURS = 122, // u16 Number of hours that DHW pump has been running or DHW valve has been opened. Reset by writing zero is optional for slave
98   - DHW_BURNER_OPERATION_HOURS = 123, // u16 Number of hours that burner is in operation during DHW mode. Reset by writing zero is optional for slave
  94 + BURNER_STARTS = 116, // u16 Number of starts burner. Reset by writing zero is optional for the secondary device
  95 + CH_PUMP_STARTS = 117, // u16 Number of starts CH pump. Reset by writing zero is optional for the secondary device
  96 + DHW_PUMP_VALVE_STARTS = 118, // u16 Number of starts DHW pump/valve. Reset by writing zero is optional for the secondary device
  97 + DHW_BURNER_STARTS = 119, // u16 Number of starts burner in DHW mode. Reset by writing zero is optional for the secondary device
  98 + BURNER_OPERATION_HOURS = 120, // u16 Number of hours that burner is in operation (i.e. flame on). Reset by writing zero is optional for the secondary device
  99 + CH_PUMP_OPERATION_HOURS = 121, // u16 Number of hours that CH pump has been running. Reset by writing zero is optional for the secondary device
  100 + DHW_PUMP_VALVE_OPERATION_HOURS = 122, // u16 Number of hours that DHW pump has been running or DHW valve has been opened. Reset by writing zero is optional for the secondary device
  101 + DHW_BURNER_OPERATION_HOURS = 123, // u16 Number of hours that burner is in operation during DHW mode. Reset by writing zero is optional for the secondary device
99 102  
100 103 // Class 5 : Pre-Defined Remote Boiler Parameters
101 104 REMOTE_PARAMETER = 6, // flag8, flag8 Remote boiler parameter transfer-enable flags, read/write flags
102 105 DHW_SETPOINT_BOUNDS = 48, // s8, s8 Upper bound for adjustment of DHW setp (ยฐC), Lower bound for adjustment of DHW setp (ยฐC)
103 106 CH_SETPOINT_BOUNDS = 49, // s8, s8 Upper bound for adjustment of maxCH setp (ยฐC), Lower bound for adjustment of maxCH setp (ยฐC)
104   - OTC_CURVE_BOUNDS = 50, // s8, s8 upp/low bnd
  107 + OTC_CURVE_BOUNDS = 50, // s8, s8 Upper / lower bound
105 108 DHW_SETPOINT = 56, // f8.8 Domestic hot water temperature setpoint (Remote parameter 1) (ยฐC)
106 109 MAX_CH_WATER_SETPOINT = 57, // f8.8 Maximum allowable CH water setpoint (Remote parameter 2) (ยฐC)
107 110 OTC_CURVE_RATIO = 58, // f8.8 OTC heat curve ratio (Remote parameter 3) (ยฐC)
108 111  
109   - // Class 6 : Transparent Slave Parameters
110   - NUMBER_OF_TSPS = 10, // u8, u8 Number of transparent-slave-parameter supported by the slave device, -Reserved-
  112 + // Class 6 : Transparent Secondary Parameters
  113 + NUMBER_OF_TSPS = 10, // u8, u8 Number of transparent-secondary-parameter supported by the secondary device, -Reserved-
111 114 TSP_COMMAND = 11, // u8, u8 Index number of following TSP, Value of the referenced TSP
112 115  
113 116 // Class 7 : Fault History Data
... ... @@ -132,9 +135,9 @@ public:
132 135 HVAC_RELATIVE_VENT_SETPOINT = 71, // f8.8 Relative ventilation position (0-100%)
133 136 HVAC_FAULT_FLAGS = 72, // flag8, u8 Application-specific fault flags and OEM fault code
134 137 HVAC_OEM_DIAGNOSTIC_CODE = 73, // u16 An OEM specific diagnostic/service code
135   - HVAC_SLAVE_CONFIGURATION = 74, // flag8, u8 Slave Configuration Flags / MemberID Code of the slave
136   - HVAC_OPENTHERM_VERSION_SLAVE = 75, // f8.8 The implemented version of the OpenTherm Protocol Specification in the slave
137   - HVAC_SLAVE_PRODUCT_VERSION = 76, // u8, u8 The slave device product version number and type as defined by the manufacturer
  138 + HVAC_SECONDARY_CONFIGURATION = 74, // flag8, u8 Secondary Configuration Flags / MemberID Code of the secondary device
  139 + HVAC_OPENTHERM_VERSION_SECONDARY= 75, // f8.8 The implemented version of the OpenTherm Protocol Specification in the secondary device
  140 + HVAC_SECONDARY_PRODUCT_VERSION = 76, // u8, u8 The secondary device product version number and type as defined by the manufacturer
138 141 HVAC_RELATIVE_VENTILATION = 77, // f8.8 Relative ventilation (0-100%)
139 142 HVAC_RELATIVE_HUMIDITY_EXHAUST = 78, // f8.8 Relative humidity exhaust air (0-100%)
140 143 HVAC_CO2_LEVEL_EXHAUST_AIR = 79, // ? CO2 level exhaust air (0-2000 ppm)
... ... @@ -146,7 +149,7 @@ public:
146 149 HVAC_SUPPLY_FAN_SPEED = 85, // u16? Supply fan speed (rpm)
147 150 HVAC_REMOTE_PARAMETER = 86, // u8, u8? MSB Remote parameter transfer enable nominal ventilation value, LSB Remote parameter read/write nominal ventilation value
148 151 HVAC_NOMINAL_RELATIVE_VENTILATION = 87, // f8.8 Nominal relative value for ventilation (0-100%)
149   - HVAC_NUMBER_OF_TSPS = 88, // u8, u8? Number of transparent-slave-parameter supported by the slave device, -Reserved-
  152 + HVAC_NUMBER_OF_TSPS = 88, // u8, u8? Number of transparent-secondary-parameter supported by the secondary device, -Reserved-
150 153 HVAC_TSP_COMMAND = 89, // u8, u8 Index number of following TSP, Value of the referenced TSP
151 154 HVAC_FAULT_BUFFER_SIZE = 90, // u8, u8? The size of the fault history buffer
152 155 HVAC_FAULT_BUFFER_DATA = 91, // u8, u8 Index number of Fault Buffer entry, Value of the referenced Fault Buffer entry
... ... @@ -155,9 +158,9 @@ public:
155 158  
156 159 // Solar specific DATA-IDs
157 160 SOLAR_FAULT_FLAGS = 102, // flag8, u8 Application-specific fault flags and OEM fault code
158   - SOLAR_SLAVE_CONFIGURATION = 103, // flag8, u8 Slave Configuration Flags / MemberID Code of the slave
159   - SOLAR_SLAVE_PRODUCT_VERSION = 104, // u8, u8 The slave device product version number and type as defined by the manufacturer
160   - SOLAR_NUMBER_OF_TSPS = 105, // u8, u8? Number of transparent-slave-parameter supported by the slave device, -Reserved-
  161 + SOLAR_SECONDARY_CONFIGURATION = 103, // flag8, u8 Secondary Configuration Flags / MemberID Code of the secondary device
  162 + SOLAR_SECONDARY_PRODUCT_VERSION = 104, // u8, u8 The secondary device product version number and type as defined by the manufacturer
  163 + SOLAR_NUMBER_OF_TSPS = 105, // u8, u8? Number of transparent-secondary-parameter supported by the secondary device, -Reserved-
161 164 SOLAR_TSP_COMMAND = 106, // u8, u8 Index number of following TSP, Value of the referenced TSP
162 165 SOLAR_FAULT_BUFFER_SIZE = 107, // u8, u8? The size of the fault history buffer
163 166 SOLAR_FAULT_BUFFER_DATA = 108, // u8, u8 Index number of Fault Buffer entry, Value of the referenced Fault Buffer entry
... ... @@ -176,13 +179,13 @@ public:
176 179  
177 180 enum class WRITE_DATA_ID {
178 181 // Class 1 : Control and Status Information
179   - CONTROL_SETPOINT_CH = 1, // f8.8 Mandatory: Control setpoint (CH water temperature setpoint) (ยฐC)
  182 + CONTROL_SETPOINT_CH = 1, // f8.8 Mandatory; Control setpoint (CH water temperature setpoint) (ยฐC)
180 183 CONTROL_SETPOINT_CH2 = 8, // f8.8 Control setpoint for 2nd CH circuit (ยฐC)
181 184  
182 185 // Class 2 : Configuration Information
183   - MASTER_CONFIGURATION = 2, // flag8, u8 Master Configuration Flags / MemberID Code of the master
184   - OPENTHERM_VERSION_MASTER = 124, // f8.8 The implemented version of the OpenTherm Protocol Specification in the master
185   - MASTER_PRODUCT_VERSION = 126, // u8, u8 The master device product version number and type as defined by the manufacturer
  186 + PRIMARY_CONFIGURATION = 2, // flag8, u8 Primary Configuration Flags / MemberID Code of the primary device
  187 + OPENTHERM_VERSION_PRIMARY = 124, // f8.8 The implemented version of the OpenTherm Protocol Specification in the primary device
  188 + PRIMARY_PRODUCT_VERSION = 126, // u8, u8 The primary device product version number and type as defined by the manufacturer
186 189  
187 190 // Class 4 : Sensor and Informational Data
188 191 ROOM_SETPOINT = 16, // f8.8 Current room temperature setpoint (ยฐC)
... ... @@ -191,26 +194,26 @@ public:
191 194 YEAR = 22, // u16 Calendar year; note : 1999-2099 will normally be sufficient
192 195 ROOM_SETPOINT_CH2 = 23, // f8.8 Current room Setpoint for 2nd CH circuit (ยฐC)
193 196 ROOM_TEMPERATURE = 24, // f8.8 Current sensed room temperature (ยฐC)
194   - BURNER_STARTS = 116, // u16 Number of starts burner. Reset by writing zero is optional for slave
195   - CH_PUMP_STARTS = 117, // u16 Number of starts CH pump. Reset by writing zero is optional for slave
196   - DHW_PUMP_VALVE_STARTS = 118, // u16 Number of starts DHW pump/valve. Reset by writing zero is optional for slave
197   - DHW_BURNER_STARTS = 119, // u16 Number of starts burner in DHW mode. Reset by writing zero is optional for slave
198   - BURNER_OPERATION_HOURS = 120, // u16 Number of hours that burner is in operation (i.e. flame on). Reset by writing zero is optional for slave
199   - CH_PUMP_OPERATION_HOURS = 121, // u16 Number of hours that CH pump has been running. Reset by writing zero is optional for slave
200   - DHW_PUMP_VALVE_OPERATION_HOURS = 122, // u16 Number of hours that DHW pump has been running or DHW valve has been opened. Reset by writing zero is optional for slave
201   - DHW_BURNER_OPERATION_HOURS = 123, // u16 Number of hours that burner is in operation during DHW mode. Reset by writing zero is optional for slave
  197 + BURNER_STARTS = 116, // u16 Number of starts burner. Reset by writing zero is optional for the secondary device
  198 + CH_PUMP_STARTS = 117, // u16 Number of starts CH pump. Reset by writing zero is optional for the secondary device
  199 + DHW_PUMP_VALVE_STARTS = 118, // u16 Number of starts DHW pump/valve. Reset by writing zero is optional for the secondary device
  200 + DHW_BURNER_STARTS = 119, // u16 Number of starts burner in DHW mode. Reset by writing zero is optional for the secondary device
  201 + BURNER_OPERATION_HOURS = 120, // u16 Number of hours that burner is in operation (i.e. flame on). Reset by writing zero is optional for the secondary device
  202 + CH_PUMP_OPERATION_HOURS = 121, // u16 Number of hours that CH pump has been running. Reset by writing zero is optional for the secondary device
  203 + DHW_PUMP_VALVE_OPERATION_HOURS = 122, // u16 Number of hours that DHW pump has been running or DHW valve has been opened. Reset by writing zero is optional for the secondary device
  204 + DHW_BURNER_OPERATION_HOURS = 123, // u16 Number of hours that burner is in operation during DHW mode. Reset by writing zero is optional for the secondary device
202 205  
203 206 // Class 5 : Pre-Defined Remote Boiler Parameters
204 207 DHW_SETPOINT = 56, // f8.8 Domestic hot water temperature setpoint (Remote parameter 1) (ยฐC)
205 208 MAX_CH_WATER_SETPOINT = 57, // f8.8 Maximum allowable CH water setpoint (Remote parameter 2) (ยฐC)
206 209 OTC_CURVE_RATIO = 58, // f8.8 OTC heat curve ratio (Remote parameter 3) (ยฐC)
207 210  
208   - // Class 6 : Transparent Slave Parameters
  211 + // Class 6 : Transparent Secondary Parameters
209 212 TSP_COMMAND = 11, // u8, u8 Index number of following TSP, Value of the referenced TSP
210 213  
211 214 // Class 8 : Control of Special Applications
212 215 COOLING_CONTROL = 7, // f8.8 Signal for cooling plant (%)
213   - MAX_MODULATION_LEVEL = 14, // f8.8 Mandatory: Maximum relative boiler modulation level setting for sequencer and off-low & pump control applications (%)
  216 + MAX_MODULATION_LEVEL = 14, // f8.8 Mandatory; Maximum relative boiler modulation level setting for sequencer and off-low & pump control applications (%)
214 217  
215 218  
216 219 // Incomplete information for DATA-IDs below. If these DATA-IDs are R, W or R/W is unknown. Also the data type is unknown and deducted from the name
... ... @@ -220,21 +223,21 @@ public:
220 223  
221 224  
222 225 enum class STATUS_FLAGS {
223   - // Master is MSB
224   - MASTER_CH_ENABLE = (0b00000001), // CH is Central Heating
225   - MASTER_DHW_ENABLE = (0b00000010), // DHW is Domestic Hot Water
226   - MASTER_COOLING_ENABLE = (0b00000100),
227   - MASTER_OTC_ENABLE = (0b00001000), // OTC is Outside Temperature Compensation
228   - MASTER_CH2_ENABLE = (0b00010000),
229   -
230   - // Slave is LSB
231   - SLAVE_FAULT_INDICATION = (0b00000001),
232   - SLAVE_CH_MODE = (0b00000010),
233   - SLAVE_DHW_MODE = (0b00000100),
234   - SLAVE_FLAME_STATUS = (0b00001000),
235   - SLAVE_COOLING_STATUS = (0b00010000),
236   - SLAVE_CH2_MODE = (0b00100000),
237   - SLAVE_DIAGNOSTIC_IND = (0b01000000),
  226 + // Primary device is MSB
  227 + PRIMARY_CH_ENABLE = (0b00000001), // CH is Central Heating
  228 + PRIMARY_DHW_ENABLE = (0b00000010), // DHW is Domestic Hot Water
  229 + PRIMARY_COOLING_ENABLE = (0b00000100),
  230 + PRIMARY_OTC_ENABLE = (0b00001000), // OTC is Outside Temperature Compensation
  231 + PRIMARY_CH2_ENABLE = (0b00010000),
  232 +
  233 + // Secondary device is LSB
  234 + SECONDARY_FAULT_INDICATION = (0b00000001),
  235 + SECONDARY_CH_MODE = (0b00000010),
  236 + SECONDARY_DHW_MODE = (0b00000100),
  237 + SECONDARY_FLAME_STATUS = (0b00001000),
  238 + SECONDARY_COOLING_STATUS = (0b00010000),
  239 + SECONDARY_CH2_MODE = (0b00100000),
  240 + SECONDARY_DIAGNOSTIC_IND = (0b01000000),
238 241 };
239 242  
240 243  
... ... @@ -274,12 +277,12 @@ public:
274 277  
275 278  
276 279 enum class CONFIGURATION_FLAGS {
277   - SLAVE_DHW_PRESENT = (0b00000001),
278   - SLAVE_CONTROL_TYPE = (0b00000010),
279   - SLAVE_COOLING = (0b00000100),
280   - SLAVE_DHW = (0b00001000),
281   - SLAVE_LOW_OFF_PUMP_CTRL = (0b00010000),
282   - SLAVE_CH2_PRESENT = (0b00100000),
  280 + SECONDARY_DHW_PRESENT = (0b00000001),
  281 + SECONDARY_CONTROL_TYPE = (0b00000010),
  282 + SECONDARY_COOLING = (0b00000100),
  283 + SECONDARY_DHW = (0b00001000),
  284 + SECONDARY_LOW_OFF_PUMP_CTRL = (0b00010000),
  285 + SECONDARY_CH2_PRESENT = (0b00100000),
283 286 };
284 287  
285 288  
... ... @@ -305,30 +308,30 @@ public:
305 308  
306 309  
307 310 enum class HVAC_STATUS_FLAGS {
308   - // Master is MSB
309   - MASTER_VENTILATION_ENABLE = (0b00000001),
310   - MASTER_BYPASS_POSTION = (0b00000010),
311   - MASTER__BYPASS_MODE = (0b00000100),
312   - MASTER_FREE_VENTILATION_MODE = (0b00001000),
313   -
314   - // Slave is LSB
315   - SLAVE_FAULT_INDICATION = (0b00000001),
316   - SLAVE_VENTILATION_MODE = (0b00000010),
317   - SLAVE_BYPASS_STATUS = (0b00000100),
318   - SLAVE_BYPASS_AUTOMATIC_STATUS = (0b00001000),
319   - SLAVE_FREE_VENTILATION_MODE = (0b00010000),
320   - SLAVE_DIAGNOSTIC_IND = (0b00100000),
  311 + // Primary device is MSB
  312 + PRIMARY_VENTILATION_ENABLE = (0b00000001),
  313 + PRIMARY_BYPASS_POSTION = (0b00000010),
  314 + PRIMARY_BYPASS_MODE = (0b00000100),
  315 + PRIMARY_FREE_VENTILATION_MODE = (0b00001000),
  316 +
  317 + // Secondary device is LSB
  318 + SECONDARY_FAULT_INDICATION = (0b00000001),
  319 + SECONDARY_VENTILATION_MODE = (0b00000010),
  320 + SECONDARY_BYPASS_STATUS = (0b00000100),
  321 + SECONDARY_BYPASS_AUTOMATIC_STATUS= (0b00001000),
  322 + SECONDARY_FREE_VENTILATION_MODE = (0b00010000),
  323 + SECONDARY_DIAGNOSTIC_IND = (0b00100000),
321 324 };
322 325  
323 326  
324 327 enum class SOLAR_STATUS_FLAGS {
325   - // Master is MSB
326   - MASTER_MODE = (0b00000111),
  328 + // Priamry device is MSB
  329 + PRIMARY_MODE = (0b00000111),
327 330  
328   - // Slave is LSB
329   - SLAVE_FAULT_INDICATION = (0b00000001),
330   - SLAVE_MODE = (0b00001110),
331   - SLAVE_STATUS = (0b00110000),
  331 + // Secondary device is LSB
  332 + SECONDARY_FAULT_INDICATION = (0b00000001),
  333 + SECONDARY_MODE = (0b00001110),
  334 + SECONDARY_STATUS = (0b00110000),
332 335 };
333 336  
334 337  
... ... @@ -339,8 +342,8 @@ public:
339 342 };
340 343  
341 344  
342   - enum class SOLAR_SLAVE_CONFIGURATION_FLAGS {
343   - SLAVE_SYSTEM_TYPE = (0b00000001),
  345 + enum class SOLAR_SECONDARY_CONFIGURATION_FLAGS {
  346 + SECONDARY_SYSTEM_TYPE = (0b00000001),
344 347 };
345 348  
346 349  
... ... @@ -396,7 +399,7 @@ private:
396 399 uint8_t _txPin;
397 400  
398 401 time_t _timeoutMs;
399   - bool _master;
  402 + bool _primary;
400 403  
401 404 ERROR_CODES _lastError;
402 405 };
... ... @@ -405,15 +408,15 @@ private:
405 408 class OTDataLinkLayer {
406 409 public:
407 410 enum class MSG_TYPE {
408   - MASTER_TO_SLAVE_READ_DATA = (0b0000000UL << 24), // value >> 28 := 0
409   - MASTER_TO_SLAVE_WRITE_DATA = (0b0010000UL << 24), // value >> 28 := 1
410   - MASTER_TO_SLAVE_INVALID_DATA = (0b0100000UL << 24), // value >> 28 := 2
411   - MASTER_TO_SLAVE_RESERVED = (0b0110000UL << 24), // value >> 28 := 3
412   -
413   - SLAVE_TO_MASTER_READ_ACK = (0b1000000UL << 24), // value >> 28 := 4
414   - SLAVE_TO_MASTER_WRITE_ACK = (0b1010000UL << 24), // value >> 28 := 5
415   - SLAVE_TO_MASTER_DATA_INVALID = (0b1100000UL << 24), // value >> 28 := 6
416   - SLAVE_TO_MASTER_UNKNOWN_DATA_ID = (0b1110000UL << 24) // value >> 28 := 7
  411 + PRIMARY_TO_SECONDARY_READ_DATA = (0b0000000UL << 24), // value >> 28 := 0
  412 + PRIMARY_TO_SECONDARY_WRITE_DATA = (0b0010000UL << 24), // value >> 28 := 1
  413 + PRIMARY_TO_SECONDARY_INVALID_DATA = (0b0100000UL << 24), // value >> 28 := 2
  414 + PRIMARY_TO_SECONDARY_RESERVED = (0b0110000UL << 24), // value >> 28 := 3
  415 +
  416 + SECONDARY_TO_PRIMARY_READ_ACK = (0b1000000UL << 24), // value >> 28 := 4
  417 + SECONDARY_TO_PRIMARY_WRITE_ACK = (0b1010000UL << 24), // value >> 28 := 5
  418 + SECONDARY_TO_PRIMARY_DATA_INVALID = (0b1100000UL << 24), // value >> 28 := 6
  419 + SECONDARY_TO_PRIMARY_UNKNOWN_DATA_ID = (0b1110000UL << 24) // value >> 28 := 7
417 420 };
418 421  
419 422 OTDataLinkLayer();
... ... @@ -463,7 +466,7 @@ class OTPhysicalLayer {
463 466 public:
464 467 OTPhysicalLayer(uint8_t rxPin,
465 468 uint8_t txPin,
466   - bool master);
  469 + bool primary);
467 470  
468 471 ~OTPhysicalLayer();
469 472  
... ... @@ -490,7 +493,7 @@ private:
490 493  
491 494 uint8_t _rxPin;
492 495 uint8_t _txPin;
493   - bool _master;
  496 + bool _primary;
494 497  
495 498 enum class STATE {
496 499 INVALID,
... ...