mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 11:26:39 +00:00
[lvgl] Reject ESP8266 at validation (#20099)
This commit is contained in:
@@ -48,6 +48,7 @@ from esphome.cpp_generator import MockObj
|
||||
from esphome.final_validate import full_config
|
||||
from esphome.helpers import write_file_if_changed
|
||||
from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor
|
||||
from esphome.types import ConfigType
|
||||
from esphome.writer import clean_build
|
||||
from esphome.yaml_util import load_yaml
|
||||
|
||||
@@ -641,7 +642,15 @@ LVGL_TOP_LEVEL_SCHEMA = (
|
||||
)
|
||||
|
||||
|
||||
def _not_on_esp8266(config: ConfigType) -> ConfigType:
|
||||
# ESP8266 does not have enough RAM for LVGL to be practical.
|
||||
if CORE.is_esp8266:
|
||||
raise cv.Invalid("LVGL is not supported on ESP8266")
|
||||
return config
|
||||
|
||||
|
||||
LVGL_SCHEMA = cv.All(
|
||||
_not_on_esp8266,
|
||||
container_schema(obj_spec, LVGL_TOP_LEVEL_SCHEMA),
|
||||
cv.has_at_most_one_key(CONF_PAGES, df.CONF_LAYOUT),
|
||||
add_hello_world,
|
||||
|
||||
@@ -1037,7 +1037,7 @@ void lv_mem_init() {}
|
||||
|
||||
void lv_mem_deinit() {}
|
||||
|
||||
#if defined(USE_HOST) || defined(USE_RP2) || defined(USE_ESP8266)
|
||||
#ifndef USE_ESP32
|
||||
void *lv_malloc_core(size_t size) {
|
||||
auto *ptr = malloc(size); // NOLINT
|
||||
if (ptr == nullptr) {
|
||||
@@ -1053,7 +1053,7 @@ static void *lv_alloc_draw_buf(size_t size, bool internal) {
|
||||
return malloc(size); // NOLINT
|
||||
}
|
||||
|
||||
#elif defined(USE_ESP32)
|
||||
#else
|
||||
static unsigned cap_bits = MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT; // NOLINT
|
||||
|
||||
static void *lv_alloc_draw_buf(size_t size, bool internal) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
"""LVGL rejects ESP8266 at validation time."""
|
||||
|
||||
import pytest
|
||||
|
||||
from esphome.components import lvgl
|
||||
from esphome.config_validation import Invalid
|
||||
from esphome.const import PlatformFramework
|
||||
from tests.component_tests.types import SetCoreConfigCallable
|
||||
|
||||
|
||||
def test_esp8266_is_rejected(set_core_config: SetCoreConfigCallable) -> None:
|
||||
set_core_config(PlatformFramework.ESP8266_ARDUINO)
|
||||
with pytest.raises(Invalid, match="not supported on ESP8266"):
|
||||
lvgl.CONFIG_SCHEMA({})
|
||||
Reference in New Issue
Block a user