mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Read long telegrams complete
This commit is contained in:
@@ -162,7 +162,6 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
||||
|
||||
for (uint8_t i = 0; i < set_typeids.size(); i++) {
|
||||
EMSESP::send_read_request(set_typeids[i], device_id);
|
||||
EMSESP::send_read_request(set_typeids[i], device_id, 0x1B);
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < summer_typeids.size(); i++) {
|
||||
|
||||
@@ -790,6 +790,10 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
txservice_.send_poll(); // close the bus
|
||||
txservice_.reset_retry_count();
|
||||
tx_successful = true;
|
||||
// if telegram is longer read next part with offset + 25 for ems+
|
||||
if (length == 32) {
|
||||
txservice_.read_next_tx();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -567,6 +567,12 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
|
||||
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram_last_), true);
|
||||
}
|
||||
|
||||
void TxService::read_next_tx() {
|
||||
// add to the top of the queue
|
||||
uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes
|
||||
add(Telegram::Operation::TX_READ, telegram_last_->dest, telegram_last_->type_id, telegram_last_->offset + 25, message_data, 1, true);
|
||||
}
|
||||
|
||||
// checks if a telegram is sent to us matches the last Tx request
|
||||
// incoming Rx src must match the last Tx dest
|
||||
// and incoming Rx dest must be us (our ems_bus_id)
|
||||
|
||||
@@ -284,6 +284,7 @@ class TxService : public EMSbus {
|
||||
void retry_tx(const uint8_t operation, const uint8_t * data, const uint8_t length);
|
||||
bool is_last_tx(const uint8_t src, const uint8_t dest) const;
|
||||
uint16_t post_send_query();
|
||||
void read_next_tx();
|
||||
|
||||
uint8_t retry_count() const {
|
||||
return retry_count_;
|
||||
|
||||
Reference in New Issue
Block a user