mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
merge in Michael's change from v2_uart branch
This commit is contained in:
@@ -81,9 +81,10 @@ Telegram::Telegram(const uint8_t operation,
|
||||
|
||||
// returns telegram's message data bytes in hex
|
||||
std::string Telegram::to_string() const {
|
||||
if (message_length == 0) {
|
||||
if (this->message_length == 0) {
|
||||
return read_flash_string(F("<empty>"));
|
||||
}
|
||||
|
||||
uint8_t data[EMS_MAX_TELEGRAM_LENGTH];
|
||||
uint8_t length = 0;
|
||||
data[0] = this->src ^ RxService::ems_mask();
|
||||
@@ -99,8 +100,7 @@ std::string Telegram::to_string() const {
|
||||
data[2] = this->type_id;
|
||||
length = 5;
|
||||
}
|
||||
}
|
||||
if (this->operation == Telegram::Operation::TX_WRITE) {
|
||||
} else if (this->operation == Telegram::Operation::TX_WRITE) {
|
||||
data[1] = this->dest;
|
||||
if (this->type_id > 0xFF) {
|
||||
data[2] = 0xFF;
|
||||
@@ -114,7 +114,12 @@ std::string Telegram::to_string() const {
|
||||
for (uint8_t i = 0; i < this->message_length; i++) {
|
||||
data[length++] = this->message_data[i];
|
||||
}
|
||||
} else {
|
||||
for (uint8_t i = 0; i < this->message_length; i++) {
|
||||
data[length++] = this->message_data[i];
|
||||
}
|
||||
}
|
||||
|
||||
return Helpers::data_to_hex(data, length);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user