From 554c2b56602bd755f02670fd3f419ff0e2acfc8d Mon Sep 17 00:00:00 2001 From: clydebarrow <2366188+clydebarrow@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:06:39 +1100 Subject: [PATCH] [packet_interface] Log a full queue during a link reset only once While the peer is away the layers above keep sending, so the message repeated about once a second until the link came up again. Co-Authored-By: Claude Opus 5.5 --- esphome/components/packet_interface/hdlc_reliability.cpp | 5 ++++- esphome/components/packet_interface/hdlc_reliability.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/components/packet_interface/hdlc_reliability.cpp b/esphome/components/packet_interface/hdlc_reliability.cpp index 6c0aca24abb..cb7fc24b146 100644 --- a/esphome/components/packet_interface/hdlc_reliability.cpp +++ b/esphome/components/packet_interface/hdlc_reliability.cpp @@ -113,7 +113,9 @@ bool HdlcReliability::send_to_interface(const PacketBuffer &data, const PacketMe if (outstanding >= this->max_queue_length_) { if (this->state_ == LinkState::LINK_STATE_CONNECTED) { ESP_LOGV(TAG, "%s: Send queue full", this->name_); - } else { + } else if (!this->reset_wait_logged_) { + // Once for each reset; the layers above keep trying while the peer is away + this->reset_wait_logged_ = true; ESP_LOGD(TAG, "%s: Send queue full, waiting for the peer to answer the link reset", this->name_); } return false; @@ -230,6 +232,7 @@ void HdlcReliability::start_reset_() { void HdlcReliability::link_up_() { ESP_LOGD(TAG, "%s: Link connected", this->name_); this->state_ = LinkState::LINK_STATE_CONNECTED; + this->reset_wait_logged_ = false; this->peer_frame_seen_ = false; this->retries_ = 0; this->cancel_timeout(RETRANSMIT_TIMER_ID); diff --git a/esphome/components/packet_interface/hdlc_reliability.h b/esphome/components/packet_interface/hdlc_reliability.h index 21e97609dbe..623b7fbc76f 100644 --- a/esphome/components/packet_interface/hdlc_reliability.h +++ b/esphome/components/packet_interface/hdlc_reliability.h @@ -92,6 +92,7 @@ class HdlcReliability : public PacketInterface { bool rej_sent_{false}; bool peer_frame_seen_{false}; // a numbered frame has arrived since the link came up bool oversize_warned_{false}; + bool reset_wait_logged_{false}; // the queue filled while waiting for this reset to be answered }; } // namespace esphome::packet_interface