mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
show read/write direction in pretty-telegram
This commit is contained in:
@@ -391,6 +391,7 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
std::string src_name;
|
std::string src_name;
|
||||||
std::string dest_name;
|
std::string dest_name;
|
||||||
std::string type_name;
|
std::string type_name;
|
||||||
|
std::string direction;
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice) {
|
if (emsdevice) {
|
||||||
// get src & dest
|
// get src & dest
|
||||||
@@ -425,13 +426,20 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
type_name = read_flash_string(F("?"));
|
type_name = read_flash_string(F("?"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (telegram->dest & 0x80) {
|
||||||
|
direction = read_flash_string(F("<-"));
|
||||||
|
} else {
|
||||||
|
direction = read_flash_string(F("->"));
|
||||||
|
}
|
||||||
|
|
||||||
std::string str(200, '\0');
|
std::string str(200, '\0');
|
||||||
if (offset) {
|
if (offset) {
|
||||||
snprintf_P(&str[0],
|
snprintf_P(&str[0],
|
||||||
str.capacity() + 1,
|
str.capacity() + 1,
|
||||||
PSTR("%s(0x%02X) -> %s(0x%02X), %s(0x%02X), data: %s (offset %d)"),
|
PSTR("%s(0x%02X) %s %s(0x%02X), %s(0x%02X), data: %s (offset %d)"),
|
||||||
src_name.c_str(),
|
src_name.c_str(),
|
||||||
src,
|
src,
|
||||||
|
direction.c_str(),
|
||||||
dest_name.c_str(),
|
dest_name.c_str(),
|
||||||
dest,
|
dest,
|
||||||
type_name.c_str(),
|
type_name.c_str(),
|
||||||
@@ -441,9 +449,10 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
} else {
|
} else {
|
||||||
snprintf_P(&str[0],
|
snprintf_P(&str[0],
|
||||||
str.capacity() + 1,
|
str.capacity() + 1,
|
||||||
PSTR("%s(0x%02X) -> %s(0x%02X), %s(0x%02X), data: %s"),
|
PSTR("%s(0x%02X) %s %s(0x%02X), %s(0x%02X), data: %s"),
|
||||||
src_name.c_str(),
|
src_name.c_str(),
|
||||||
src,
|
src,
|
||||||
|
direction.c_str(),
|
||||||
dest_name.c_str(),
|
dest_name.c_str(),
|
||||||
dest,
|
dest,
|
||||||
type_name.c_str(),
|
type_name.c_str(),
|
||||||
|
|||||||
Reference in New Issue
Block a user