mirror of
https://github.com/esphome/esphome.git
synced 2025-07-27 05:36:38 +00:00
[nextion] Allocate NextionQueue in PSRAM (if available) (#8979)
This commit is contained in:
parent
32e69c67f2
commit
a2e4ad90ba
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user