diff --git a/src/emsdevice.h b/src/emsdevice.h index 3e881cff5..8a4b336f2 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -392,8 +392,12 @@ class EMSdevice { static constexpr uint8_t EMS_DEVICE_ID_DHW8 = 0x2F; // last DHW module id? // generic type IDs - static constexpr uint16_t EMS_TYPE_VERSION = 0x02; // type ID for Version information. Generic across all EMS devices. - static constexpr uint16_t EMS_TYPE_UBADevices = 0x07; // EMS connected devices + static constexpr uint16_t EMS_TYPE_VERSION = 0x02; // type ID for Version information. Generic across all EMS devices. + static constexpr uint16_t EMS_TYPE_UBADevices = 0x07; // EMS connected devices + static constexpr uint16_t EMS_TYPE_DEVICEERROR = 0xBE; + static constexpr uint16_t EMS_TYPE_SYSTEMERROR = 0xBF; + static constexpr uint16_t EMS_TYPE_MENUCONFIG = 0xF7; + static constexpr uint16_t EMS_TYPE_VALUECONFIG = 0xF9; // device flags: The lower 4 bits hold the unique identifier, the upper 4 bits are used for specific flags static constexpr uint8_t EMS_DEVICE_FLAG_NONE = 0; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 2bbf75a08..50374522f 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -775,23 +775,39 @@ std::string EMSESP::pretty_telegram(std::shared_ptr telegram) { dest_name = device_tostring(dest); } - // check for global/common types like Version & UBADevices - if (telegram->type_id == EMSdevice::EMS_TYPE_VERSION) { - type_name = "Version"; - } else if (telegram->type_id == EMSdevice::EMS_TYPE_UBADevices) { - type_name = "UBADevices"; - } - // if we don't know the type show if (type_name.empty()) { - type_name = "?"; + // check for global/common types like Version & UBADevices + switch (telegram->type_id) { + case EMSdevice::EMS_TYPE_VERSION: + type_name = "Version"; + break; + case EMSdevice::EMS_TYPE_UBADevices: + type_name = "UBADevices"; + break; + case EMSdevice::EMS_TYPE_DEVICEERROR: + type_name = "DeviceError"; + break; + case EMSdevice::EMS_TYPE_SYSTEMERROR: + type_name = "SystemError"; + break; + case EMSdevice::EMS_TYPE_MENUCONFIG: + type_name = "MenuConfig"; + break; + case EMSdevice::EMS_TYPE_VALUECONFIG: + type_name = "ValueConfig"; + break; + default: + type_name = "?"; + } } std::string str; str.reserve(200); if (telegram->operation == Telegram::Operation::RX_READ) { str = src_name + "(" + Helpers::hextoa(src) + ") -R-> " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "(" - + Helpers::hextoa(telegram->type_id) + "), length: " + Helpers::hextoa(telegram->message_data[0]); + + Helpers::hextoa(telegram->type_id) + "), length: " + Helpers::hextoa(telegram->message_data[0]) + + ((telegram->message_length > 1) ? ", data: " + Helpers::data_to_hex(telegram->message_data + 1, telegram->message_length - 1) : ""); } else if (telegram->dest == 0) { str = src_name + "(" + Helpers::hextoa(src) + ") -B-> " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "(" + Helpers::hextoa(telegram->type_id) + "), data: " + telegram->to_string_message();