mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
fix devices scan - #326
This commit is contained in:
16
src/ems.cpp
16
src/ems.cpp
@@ -1759,9 +1759,9 @@ bool _addDevice(_EMS_DEVICE_TYPE device_type, uint8_t product_id, uint8_t device
|
|||||||
*/
|
*/
|
||||||
void _process_UBADevices(_EMS_RxTelegram * EMS_RxTelegram) {
|
void _process_UBADevices(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||||
// exit it length is incorrect (13 or 15 bytes long)
|
// exit it length is incorrect (13 or 15 bytes long)
|
||||||
// or didn't come from the boiler
|
// or it wasn't specifically for us
|
||||||
// or we can't write to the EMS bus yet
|
// or we can't write to the EMS bus yet
|
||||||
if ((EMS_RxTelegram->data_length > EMS_SYS_DEVICEMAP_LENGTH) || (EMS_RxTelegram->src != EMS_ID_BOILER) || (ems_getTxDisabled())) {
|
if ((EMS_RxTelegram->data_length > EMS_SYS_DEVICEMAP_LENGTH) || (EMS_RxTelegram->dest != EMS_Sys_Status.emsbusid) || (ems_getTxDisabled())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1772,14 +1772,15 @@ void _process_UBADevices(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
for (uint8_t bit = 0; bit < 8; bit++) {
|
for (uint8_t bit = 0; bit < 8; bit++) {
|
||||||
if (byte & 0x01) {
|
if (byte & 0x01) {
|
||||||
uint8_t device_id = ((data_byte + 1) * 8) + bit;
|
uint8_t device_id = ((data_byte + 1) * 8) + bit;
|
||||||
// ignore ourselves, we're not an EMS device
|
|
||||||
if ((device_id != EMS_Sys_Status.emsbusid) && (!Devices.empty())) {
|
|
||||||
// see if we already have this device in our list
|
// see if we already have this device in our list
|
||||||
|
// ignore ourselves, we're not an EMS device
|
||||||
|
if (device_id != EMS_Sys_Status.emsbusid) {
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
|
if (!Devices.empty()) {
|
||||||
for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) {
|
for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) {
|
||||||
if (it->device_id == device_id) {
|
if (it->device_id == device_id) {
|
||||||
exists = true;
|
exists = true;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
@@ -1787,9 +1788,8 @@ void _process_UBADevices(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
ems_doReadCommand(EMS_TYPE_Version, device_id); // get version, but ignore ourselves
|
ems_doReadCommand(EMS_TYPE_Version, device_id); // get version, but ignore ourselves
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// advance 1 bit
|
|
||||||
byte = byte >> 1;
|
|
||||||
}
|
}
|
||||||
|
byte = byte >> 1; // advance 1 bit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2260,7 +2260,7 @@ void ems_printDevices() {
|
|||||||
myDebug_P(PSTR("One or more devices are not recognized by EMS-ESP. Please report this in GitHub."));
|
myDebug_P(PSTR("One or more devices are not recognized by EMS-ESP. Please report this in GitHub."));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
myDebug_P(PSTR("No were devices recognized. This may be because Tx is disabled or failing."));
|
myDebug_P(PSTR("No devices were recognized. This may be because Tx is disabled or failing."));
|
||||||
}
|
}
|
||||||
|
|
||||||
myDebug_P(PSTR("")); // newline
|
myDebug_P(PSTR("")); // newline
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define APP_VERSION "1.9.5b36"
|
#define APP_VERSION "1.9.5b37"
|
||||||
|
|||||||
Reference in New Issue
Block a user