mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix overlaping while reading sequence of EMS1.0 telegrams
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user