mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-04-02 15:06:32 +03:00
fix poll_match_count
This commit is contained in:
@@ -1600,12 +1600,12 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
wait_km_ = true;
|
wait_km_ = true;
|
||||||
connect_time = uuid::get_uptime_sec();
|
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
|
// 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()) {
|
if (poll_id == EMSbus::ems_bus_id()) {
|
||||||
EMSbus::poll_matched(uuid::get_uptime());
|
EMSbus::poll_matched(uuid::get_uptime());
|
||||||
} else {
|
|
||||||
EMSbus::poll_match_reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait_km_) {
|
if (wait_km_) {
|
||||||
if (poll_id != 0x48 && (uuid::get_uptime_sec() - connect_time) < EMS_WAIT_KM_TIMEOUT) {
|
if (poll_id != 0x48 && (uuid::get_uptime_sec() - connect_time) < EMS_WAIT_KM_TIMEOUT) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ class EMSbus {
|
|||||||
|
|
||||||
// sets the flag for EMS bus connected
|
// sets the flag for EMS bus connected
|
||||||
static void last_bus_activity(uint32_t timestamp) {
|
static void last_bus_activity(uint32_t timestamp) {
|
||||||
|
// record the first time we connected to the BUS, as this will be our uptime
|
||||||
if (!last_bus_activity_) {
|
if (!last_bus_activity_) {
|
||||||
bus_uptime_start_ = timestamp;
|
bus_uptime_start_ = timestamp;
|
||||||
}
|
}
|
||||||
@@ -222,10 +223,6 @@ class EMSbus {
|
|||||||
bus_connected_ = true;
|
bus_connected_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void poll_match_reset() {
|
|
||||||
poll_match_count_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return bus uptime in seconds
|
// return bus uptime in seconds
|
||||||
static uint32_t bus_uptime() {
|
static uint32_t bus_uptime() {
|
||||||
if (!bus_uptime_start_) {
|
if (!bus_uptime_start_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user