fix raw telegram write from other id

This commit is contained in:
MichaelDvP
2024-06-05 19:31:46 +02:00
parent a2ba88fe26
commit 1883c98b39

View File

@@ -336,8 +336,8 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
telegram_raw[3] = telegram->offset; telegram_raw[3] = telegram->offset;
// EMS+ has different format for read and write // EMS+ has different format for read and write
if (telegram->operation == Telegram::Operation::TX_WRITE) { if (telegram->operation != Telegram::Operation::TX_READ) {
// WRITE // WRITE/NONE
telegram_raw[4] = (telegram->type_id >> 8) - 1; // type, 1st byte, high-byte, subtract 0x100 telegram_raw[4] = (telegram->type_id >> 8) - 1; // type, 1st byte, high-byte, subtract 0x100
telegram_raw[5] = telegram->type_id & 0xFF; // type, 2nd byte, low-byte telegram_raw[5] = telegram->type_id & 0xFF; // type, 2nd byte, low-byte
message_p = 6; message_p = 6;
@@ -382,7 +382,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
} }
LOG_DEBUG("Sending %s Tx [#%d], telegram: %s", LOG_DEBUG("Sending %s Tx [#%d], telegram: %s",
(telegram->operation == Telegram::Operation::TX_WRITE) ? ("write") : ("read"), (telegram->operation != Telegram::Operation::TX_READ) ? ("write") : ("read"),
tx_telegram.id_, tx_telegram.id_,
Helpers::data_to_hex(telegram_raw, length - 1).c_str()); // exclude the last CRC byte Helpers::data_to_hex(telegram_raw, length - 1).c_str()); // exclude the last CRC byte