diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index 435222e00..9d583e427 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -1601,9 +1601,8 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { connect_time = uuid::get_uptime_sec(); } - // this could also be by coincidence, so we should add a counter to the EMSbus class to check if the poll_id is the same as the EMS_BUS_ID for a certain number of times if (poll_id == EMSbus::ems_bus_id()) { - EMSbus::poll_matched(uuid::get_uptime()); + EMSbus::last_bus_activity(uuid::get_uptime()); // set the flag indication the EMS bus is active } if (wait_km_) { diff --git a/src/core/telegram.cpp b/src/core/telegram.cpp index 372d8e690..67d4bc4ad 100644 --- a/src/core/telegram.cpp +++ b/src/core/telegram.cpp @@ -39,7 +39,6 @@ const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, uint32_t EMSbus::last_bus_activity_ = 0; // timestamp of last time a valid Rx came in uint32_t EMSbus::bus_uptime_start_ = 0; // timestamp of when the bus was started bool EMSbus::bus_connected_ = false; // start assuming the bus hasn't been connected -uint8_t EMSbus::poll_match_count_ = 0; // consecutive poll ID matches uint8_t EMSbus::ems_mask_ = EMS_MASK_UNSET; // unset so its triggered when booting, the its 0x00=buderus, 0x80=junker/ht3 uint8_t EMSbus::ems_bus_id_ = EMSESP_DEFAULT_EMS_BUS_ID; uint8_t EMSbus::tx_mode_ = EMSESP_DEFAULT_TX_MODE; diff --git a/src/core/telegram.h b/src/core/telegram.h index b1cd64dfb..c0fd9d86a 100644 --- a/src/core/telegram.h +++ b/src/core/telegram.h @@ -205,14 +205,6 @@ class EMSbus { #endif } - // called on each poll match; requires EMS_POLL_MATCH_LIMIT consecutive matches before declaring bus connected - static void poll_matched(uint32_t timestamp) { - if (++poll_match_count_ < EMS_POLL_MATCH_LIMIT) { - return; - } - last_bus_activity(timestamp); - } - // sets the flag for EMS bus connected static void last_bus_activity(uint32_t timestamp) { // record the first time we connected to the BUS, as this will be our uptime @@ -246,7 +238,6 @@ class EMSbus { static uint32_t last_bus_activity_; // timestamp of last time a valid Rx came in static uint32_t bus_uptime_start_; // timestamp of first time we connected to the bus static bool bus_connected_; // start assuming the bus hasn't been connected - static uint8_t poll_match_count_; // consecutive poll ID matches seen so far static uint8_t ems_mask_; // unset=0xFF, buderus=0x00, junkers/ht3=0x80 static uint8_t ems_bus_id_; // the bus id, which configurable and stored in settings static uint8_t tx_mode_; // local copy of the tx mode