fix overlaping while reading sequence of EMS1.0 telegrams

This commit is contained in:
pswid
2021-12-14 10:29:15 +01:00
parent 1343bbf6ea
commit 9cd20cfc05
3 changed files with 9 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
## Fixed ## Fixed
- lastcode broke MQTT JSON structure [#228] - lastcode broke MQTT JSON structure [#228]
- overlapping while reading 0xC2 from Boiler - overlapping while reading sequence of EMS1.0 telegrams
- redundant telegram readings (because of offset overflow) - redundant telegram readings (because of offset overflow)
## Changed ## Changed

View File

@@ -1191,7 +1191,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
txservice_.send_poll(); // close the bus txservice_.send_poll(); // close the bus
txservice_.reset_retry_count(); txservice_.reset_retry_count();
tx_successful = true; tx_successful = true;
// if telegram is longer read next part with offset + 25 for ems+ // if telegram is longer read next part with offset +25 for ems+ or +27 for ems1.0
if (length == 32) { if (length == 32) {
if (txservice_.read_next_tx(data[3]) == read_id_) { if (txservice_.read_next_tx(data[3]) == read_id_) {
read_next_ = true; read_next_ = true;

View File

@@ -613,12 +613,19 @@ uint16_t TxService::read_next_tx(uint8_t offset) {
if (telegram_last_->offset != offset) { if (telegram_last_->offset != offset) {
return 0; return 0;
} }
<<<<<<< Updated upstream
uint8_t add_offset; uint8_t add_offset;
if (telegram_last_->dest == 0x08 && telegram_last_->type_id == 0xC2) { //fix for overlapping 0xC2 telegrams from Boiler. Are other telegrams also affected? if (telegram_last_->dest == 0x08 && telegram_last_->type_id == 0xC2) { //fix for overlapping 0xC2 telegrams from Boiler. Are other telegrams also affected?
add_offset = 27; add_offset = 27;
} else { } else {
add_offset = 25; add_offset = 25;
=======
uint8_t add_offset = 25; //for EMS+ telegram increase offset by 25
if (telegram_last_->type_id < 0x100) { //but for EMS1.0 by 27
add_offset = 27;
>>>>>>> Stashed changes
} }
if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow