From d3567f9ac6ad079fb59b69b2ef03b7d0eb1660f9 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 29 Dec 2023 06:15:06 +0100 Subject: [PATCH] Nextion queue size (#6029) * Nextion `queue_size` function Returns the size of Nextion queue. For troubleshooting only. * Move `queue_size` to `nextion.h` This is where the queue is * Inline doc * clang-format --- esphome/components/nextion/nextion.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/esphome/components/nextion/nextion.h b/esphome/components/nextion/nextion.h index acbf394fc6..2f52a032c4 100644 --- a/esphome/components/nextion/nextion.h +++ b/esphome/components/nextion/nextion.h @@ -960,6 +960,21 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe this->exit_reparse_on_start_ = exit_reparse_on_start; } + /** + * @brief Retrieves the number of commands pending in the Nextion command queue. + * + * This function returns the current count of commands that have been queued but not yet processed + * for the Nextion display. The Nextion command queue is used to store commands that are sent to + * the Nextion display for various operations like updating the display, changing interface elements, + * or other interactive features. A larger queue size might indicate a higher processing time or potential + * delays in command execution. This function is useful for monitoring the command flow and managing + * the execution efficiency of the Nextion display interface. + * + * @return size_t The number of commands currently in the Nextion queue. This count includes all commands + * that have been added to the queue and are awaiting processing. + */ + size_t queue_size() { return this->nextion_queue_.size(); } + protected: std::deque nextion_queue_; std::deque waveform_queue_;