-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Room Unit emulation to custom code library
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
BSB_LAN/custom_functions/Emulation_of_Room_Unit/BSB_LAN_custom.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Emulation of temperature sensor of room unit. | ||
* You can enter up to five parameter numbers which provide temperature data (for example sensors attached to BSB-LAN) and | ||
* enter these into the three segments of "rgte_sensorid" in BSB_LAN_custom_global.h | ||
* The segments 1 to 3 correspond to the room units configured for heating circuits 1 to 3. | ||
* If you enter more than one parameter number for one segment, then an average will be calulated and sent to the heater. | ||
* A segment of all zeros means that no data will be sent to the corresponding heating circuit. | ||
*/ | ||
|
||
{ | ||
byte tempTime = (millis() / 60000) % 60; | ||
if (newMinuteValue != tempTime) { | ||
newMinuteValue = tempTime; | ||
uint8_t k = 3; // 3 circuits in BSB/LPB mode | ||
if (bus->getBusType() == BUS_PPS) { | ||
k = 1; | ||
} | ||
for (uint8_t i = 0; i < k; i++) { | ||
if (rgte_sensorid[i][0].number != 0) { | ||
uint8_t z = 0; | ||
float value = 0; | ||
for (uint8_t j = 0; j < 5; j++) { | ||
if (rgte_sensorid[i][j].number != 0) { | ||
if(rgte_sensorid[i][j].dest_addr != -1) set_temp_destination(rgte_sensorid[i][j].dest_addr); | ||
query(rgte_sensorid[i][j].number); | ||
if(rgte_sensorid[i][j].dest_addr != -1) return_to_default_destination(dest_address); | ||
if (decodedTelegram.type == VT_TEMP && decodedTelegram.error == 0) { | ||
z++; | ||
value += atof(decodedTelegram.value); | ||
} | ||
} | ||
} | ||
if (z != 0) { | ||
_printFIXPOINT(decodedTelegram.value, value / z, 2); | ||
if (bus->getBusType() != BUS_PPS) { | ||
// if we want to substitute own address sometime to RGT1(2,3) | ||
// uint8_t saved_own_address = bus->getBusAddr(); | ||
// bus->setBusType(bus->getBusType(), ADDR_RGT1 + i, bus->getBusDest()); | ||
set(10000 + i, decodedTelegram.value, false); //send INF message like RGT1 - RGT3 devices | ||
// bus->setBusType(bus->getBusType(), saved_own_address, bus->getBusDest()); | ||
} else { | ||
set(15000 + PPS_RTI, decodedTelegram.value, false); //set PPS parameter PPS_RTI (Raumtemperatur Ist) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
BSB_LAN/custom_functions/Emulation_of_Room_Unit/BSB_LAN_custom_global.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Emulation of temperature sensor of room unit. | ||
* You can enter up to five parameter numbers which provide temperature data (for example sensors attached to BSB-LAN) and | ||
* enter these into the three segments of "rgte_sensorid" in BSB_LAN_custom_global.h | ||
* The segments 1 to 3 correspond to the room units configured for heating circuits 1 to 3. | ||
* If you enter more than one parameter number for one segment, then an average will be calulated and sent to the heater. | ||
* A segment of all zeros means that no data will be sent to the corresponding heating circuit. | ||
*/ | ||
|
||
parameter rgte_sensorid[3][5] = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; //Temperature sensor program IDs for RGT1/PPS - RGT3. If zero then RGT will not be emulated. If more than one program set per RGT then average will be calculated and used. | ||
byte newMinuteValue = 99; |