1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-18 01:33:51 +01:00

[lvgl] Small buffers in internal RAM (#8523)

This commit is contained in:
Clyde Stubbs
2025-04-15 11:10:44 +10:00
committed by GitHub
parent f6ef50505b
commit 6259ca9ded

View File

@@ -433,7 +433,11 @@ void LvglComponent::setup() {
auto height = display->get_height();
size_t buffer_pixels = width * height / this->buffer_frac_;
auto buf_bytes = buffer_pixels * LV_COLOR_DEPTH / 8;
auto *buffer = lv_custom_mem_alloc(buf_bytes); // NOLINT
void *buffer = nullptr;
if (this->buffer_frac_ >= 4)
buffer = malloc(buf_bytes); // NOLINT
if (buffer == nullptr)
buffer = lv_custom_mem_alloc(buf_bytes); // NOLINT
if (buffer == nullptr) {
this->mark_failed();
this->status_set_error("Memory allocation failure");