[nextion] Allocate NextionQueue in PSRAM (if available) (#8979)

This commit is contained in:
Edward Firmo 2025-05-31 09:52:42 +02:00 committed by GitHub
parent 32e69c67f2
commit a2e4ad90ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1003,8 +1003,13 @@ uint16_t Nextion::recv_ret_string_(std::string &response, uint32_t timeout, bool
* @param variable_name Name for the queue * @param variable_name Name for the queue
*/ */
void Nextion::add_no_result_to_queue_(const std::string &variable_name) { void Nextion::add_no_result_to_queue_(const std::string &variable_name) {
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory) ExternalRAMAllocator<nextion::NextionQueue> allocator(ExternalRAMAllocator<nextion::NextionQueue>::ALLOW_FAILURE);
nextion::NextionQueue *nextion_queue = new nextion::NextionQueue; nextion::NextionQueue *nextion_queue = allocator.allocate(1);
if (nextion_queue == nullptr) {
ESP_LOGW(TAG, "Failed to allocate NextionQueue");
return;
}
new (nextion_queue) nextion::NextionQueue();
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory) // NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
nextion_queue->component = new nextion::NextionComponentBase; nextion_queue->component = new nextion::NextionComponentBase;
@ -1137,8 +1142,13 @@ void Nextion::add_to_get_queue(NextionComponentBase *component) {
if ((!this->is_setup() && !this->ignore_is_setup_)) if ((!this->is_setup() && !this->ignore_is_setup_))
return; return;
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory) ExternalRAMAllocator<nextion::NextionQueue> allocator(ExternalRAMAllocator<nextion::NextionQueue>::ALLOW_FAILURE);
nextion::NextionQueue *nextion_queue = new nextion::NextionQueue; nextion::NextionQueue *nextion_queue = allocator.allocate(1);
if (nextion_queue == nullptr) {
ESP_LOGW(TAG, "Failed to allocate NextionQueue");
return;
}
new (nextion_queue) nextion::NextionQueue();
nextion_queue->component = component; nextion_queue->component = component;
nextion_queue->queue_time = millis(); nextion_queue->queue_time = millis();
@ -1165,8 +1175,13 @@ void Nextion::add_addt_command_to_queue(NextionComponentBase *component) {
if ((!this->is_setup() && !this->ignore_is_setup_) || this->is_sleeping()) if ((!this->is_setup() && !this->ignore_is_setup_) || this->is_sleeping())
return; return;
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory) ExternalRAMAllocator<nextion::NextionQueue> allocator(ExternalRAMAllocator<nextion::NextionQueue>::ALLOW_FAILURE);
nextion::NextionQueue *nextion_queue = new nextion::NextionQueue; nextion::NextionQueue *nextion_queue = allocator.allocate(1);
if (nextion_queue == nullptr) {
ESP_LOGW(TAG, "Failed to allocate NextionQueue");
return;
}
new (nextion_queue) nextion::NextionQueue();
nextion_queue->component = component; nextion_queue->component = component;
nextion_queue->queue_time = millis(); nextion_queue->queue_time = millis();