mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
pretty_telegram 2nd fallback for name
This commit is contained in:
@@ -742,10 +742,20 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(src)) {
|
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(src)) {
|
||||||
type_name = emsdevice->telegram_type_name(telegram);
|
type_name = emsdevice->telegram_type_name(telegram);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type_name.empty()) {
|
||||||
|
// 2nd fallback, get the type name from dest
|
||||||
|
for (const auto & emsdevice : emsdevices) {
|
||||||
|
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(dest)) {
|
||||||
|
type_name = emsdevice->telegram_type_name(telegram);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// if we can't find names for the devices, use their hex values
|
// if we can't find names for the devices, use their hex values
|
||||||
if (src_name.empty()) {
|
if (src_name.empty()) {
|
||||||
src_name = device_tostring(src);
|
src_name = device_tostring(src);
|
||||||
|
|||||||
Reference in New Issue
Block a user