mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix overlapping 0xC2 and overflow of offset
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- lastcode broke MQTT JSON structure [#228]
|
- lastcode broke MQTT JSON structure [#228]
|
||||||
|
- overlapping while reading 0xC2 from Boiler
|
||||||
|
- redundant telegram readings (because of offset overflow)
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
|||||||
@@ -613,7 +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;
|
||||||
}
|
}
|
||||||
add(Telegram::Operation::TX_READ, telegram_last_->dest, telegram_last_->type_id, telegram_last_->offset + 25, message_data, 1, 0, true);
|
|
||||||
|
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?
|
||||||
|
add_offset = 27;
|
||||||
|
} else {
|
||||||
|
add_offset = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
add(Telegram::Operation::TX_READ, telegram_last_->dest, telegram_last_->type_id, telegram_last_->offset + add_offset, message_data, 1, 0, true);
|
||||||
return telegram_last_->type_id;
|
return telegram_last_->type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user