mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 01:19:45 +08:00
[nextion] Replace std::deque queues with std::list (#15211)
This commit is contained in:
@@ -841,10 +841,10 @@ void Nextion::process_nextion_commands_() {
|
||||
|
||||
if (this->max_q_age_ms_ > 0 && !this->nextion_queue_.empty() &&
|
||||
ms - this->nextion_queue_.front()->queue_time > this->max_q_age_ms_) {
|
||||
for (size_t i = 0; i < this->nextion_queue_.size(); i++) {
|
||||
NextionComponentBase *component = this->nextion_queue_[i]->component;
|
||||
if (ms - this->nextion_queue_[i]->queue_time > this->max_q_age_ms_) {
|
||||
if (this->nextion_queue_[i]->queue_time == 0) {
|
||||
for (auto it = this->nextion_queue_.begin(); it != this->nextion_queue_.end();) {
|
||||
NextionComponentBase *component = (*it)->component;
|
||||
if (ms - (*it)->queue_time > this->max_q_age_ms_) {
|
||||
if ((*it)->queue_time == 0) {
|
||||
ESP_LOGD(TAG, "Remove old queue '%s':'%s' (t=0)", component->get_queue_type_string().c_str(),
|
||||
component->get_variable_name().c_str());
|
||||
}
|
||||
@@ -863,10 +863,8 @@ void Nextion::process_nextion_commands_() {
|
||||
delete component; // NOLINT(cppcoreguidelines-owning-memory)
|
||||
}
|
||||
|
||||
delete this->nextion_queue_[i]; // NOLINT(cppcoreguidelines-owning-memory)
|
||||
|
||||
this->nextion_queue_.erase(this->nextion_queue_.begin() + i);
|
||||
i--;
|
||||
delete *it; // NOLINT(cppcoreguidelines-owning-memory)
|
||||
it = this->nextion_queue_.erase(it);
|
||||
|
||||
} else {
|
||||
break;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "esphome/components/display/display.h"
|
||||
#include "esphome/components/display/display_color_utils.h"
|
||||
#include "esphome/components/uart/uart.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/time.h"
|
||||
|
||||
#include "esphome/components/uart/uart.h"
|
||||
#include "nextion_base.h"
|
||||
#include "nextion_component.h"
|
||||
#include "esphome/components/display/display.h"
|
||||
#include "esphome/components/display/display_color_utils.h"
|
||||
|
||||
#ifdef USE_NEXTION_TFT_UPLOAD
|
||||
#ifdef USE_ESP32
|
||||
@@ -1391,8 +1391,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
||||
void process_pending_in_queue_();
|
||||
#endif // USE_NEXTION_COMMAND_SPACING
|
||||
|
||||
std::deque<NextionQueue *> nextion_queue_;
|
||||
std::deque<NextionQueue *> waveform_queue_;
|
||||
std::list<NextionQueue *> nextion_queue_;
|
||||
std::list<NextionQueue *> waveform_queue_;
|
||||
uint16_t recv_ret_string_(std::string &response, uint32_t timeout, bool recv_flag);
|
||||
void all_components_send_state_(bool force_update = false);
|
||||
uint32_t comok_sent_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user