From 9e84fefed6d429d64312d57308d0503f5f75f11c Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 15 Jun 2020 15:00:06 +0200 Subject: [PATCH] code cleanup --- src/console.h | 3 +-- src/telegram.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/console.h b/src/console.h index 69ad657f4..02d57938e 100644 --- a/src/console.h +++ b/src/console.h @@ -41,7 +41,7 @@ using uuid::log::Level; // clang-format off -#define LOG_DEBUG(...) if (logger_.enabled(Level::DEBUG)) {logger_.debug(__VA_ARGS__);} +#define LOG_DEBUG(...) logger_.debug(__VA_ARGS__) #define LOG_INFO(...) logger_.info(__VA_ARGS__) #define LOG_TRACE(...) logger_.trace(__VA_ARGS__) #define LOG_NOTICE(...) logger_.notice(__VA_ARGS__) @@ -51,7 +51,6 @@ using uuid::log::Level; #define MAKE_PSTR(string_name, string_literal) static const char __pstr__##string_name[] __attribute__((__aligned__(sizeof(int)))) PROGMEM = string_literal; #define MAKE_PSTR_WORD(string_name) MAKE_PSTR(string_name, #string_name) #define F_(string_name) FPSTR(__pstr__##string_name) -#define NO_ARGUMENTS std::vector{} // clang-format on diff --git a/src/telegram.cpp b/src/telegram.cpp index 16e40b98d..7ee6bd0b1 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -466,8 +466,6 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { tx_telegram.id_, telegram->to_string(telegram_raw, length).c_str()); - // send the telegram to the UART Tx - uint16_t status = EMSuart::transmit(telegram_raw, length); #ifdef EMSESP_DEBUG // if watching in 'raw' mode if (EMSESP::watch() == 2) { @@ -475,6 +473,9 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { } #endif + // send the telegram to the UART Tx + uint16_t status = EMSuart::transmit(telegram_raw, length); + if (status == EMS_TX_STATUS_ERR) { LOG_ERROR(F("Failed to transmit Tx via UART.")); increment_telegram_fail_count(); // another Tx fail @@ -616,7 +617,6 @@ void TxService::remember_tx(const uint8_t * data, const uint8_t length) { if (ems_mask() != EMS_MASK_UNSET) { telegram_last_[0] ^= ems_mask(); } - } // add last Tx to tx queue and increment count