respond all telegram parts if request length >= 32

This commit is contained in:
MichaelDvP
2023-07-15 12:27:48 +02:00
parent 6d0bd099e1
commit 7a5f13bcad
2 changed files with 9 additions and 1 deletions

View File

@@ -854,6 +854,9 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
if (telegram->type_id == response_id_) {
publish_response(telegram);
response_id_ = 0;
if (!read_next_) {
response_id_ = 0;
}
}
// check if read is finished or gives more parts
if (!read_next_) {
@@ -1317,7 +1320,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
// if telegram is longer read next part with offset +25 for ems+ or +27 for ems1.0
// not for response to raw send commands
if ((response_id_ == 0) && (length >= 31) && (txservice_.read_next_tx(data[3], length) == read_id_)) {
if ((response_id_ == 0 || read_id_ > 0) && (length >= 31) && (txservice_.read_next_tx(data[3], length) == read_id_)) {
read_next_ = true;
}
}

View File

@@ -513,6 +513,11 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt
} else if (dest & 0x80) {
operation = Telegram::Operation::TX_READ;
EMSESP::set_response_id(type_id);
// trigger read of all parts of telegram if requested length is more than 32
// compatibility to earlier versions
if (message_data[0] >= 32) {
EMSESP::set_read_id(type_id);
}
} else {
operation = Telegram::Operation::TX_WRITE;
validate_id = type_id;