diff --git a/src/telegram.cpp b/src/telegram.cpp index 07026b4b8..66420ea93 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -388,10 +388,9 @@ void TxService::send() { return; } - // if there's nothing in the queue to send - // optionally, send back a poll and quit + // if there's nothing in the queue to transmit, send back a poll and quit if (tx_telegrams_.empty()) { - // send_poll(); // TODO commented out poll for now. should add back when stable. + send_poll(); return; } @@ -409,7 +408,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { // build the header auto telegram = tx_telegram.telegram_; - // src - set MSB if its Junkers/HT3 + // src - set MSB if it's Junkers/HT3 uint8_t src = telegram->src; if (ems_mask() != EMS_MASK_UNSET) { src ^= ems_mask(); @@ -484,7 +483,10 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { // send the telegram to the UART Tx EMSUART_STATUS status = EMSuart::transmit(telegram_raw, length); - //LOG_TRACE(F("Tx: %s"), Helpers::data_to_hex(telegram_raw, length).c_str()); +#ifdef EMSESP_DEBUG + LOG_TRACE(F("Tx: %s"), Helpers::data_to_hex(telegram_raw, length).c_str()); +#endif + if (status != EMS_TX_STATUS_OK) { LOG_ERROR(F("Failed to transmit Tx via UART. Error: %s"), status == EMS_TX_WTD_TIMEOUT ? F("Timeout") : F("BRK")); }