mirror of
https://github.com/esphome/esphome.git
synced 2026-11-16 18:16:04 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c9033e04d | ||
|
|
e91934e4bd |
No files matched your search
@@ -181,7 +181,7 @@ _IDF6_ETHERNET_COMPONENTS: dict[str, IDFRegistryComponent] = {
|
||||
"IP101": IDFRegistryComponent("espressif/ip101", "1.1.0"),
|
||||
"KSZ8081": IDFRegistryComponent("espressif/ksz80xx", "1.1.0"),
|
||||
"KSZ8081RNA": IDFRegistryComponent("espressif/ksz80xx", "1.1.0"),
|
||||
"W5500": IDFRegistryComponent("espressif/w5500", "2.0.1"),
|
||||
"W5500": IDFRegistryComponent("espressif/w5500", "1.0.1"),
|
||||
"DM9051": IDFRegistryComponent("espressif/dm9051", "1.1.1"),
|
||||
"ENC28J60": IDFRegistryComponent("espressif/enc28j60", "1.1.0"),
|
||||
"LAN8670": IDFRegistryComponent("espressif/lan867x", "2.1.0"),
|
||||
|
||||
@@ -286,16 +286,9 @@ void EthernetComponent::ethernet_lazy_init_() {
|
||||
#endif
|
||||
|
||||
#if defined(USE_ETHERNET_W5500)
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
|
||||
w5500_config.base.int_gpio_num = this->interrupt_pin_;
|
||||
#ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
|
||||
w5500_config.base.poll_period_ms = this->polling_interval_;
|
||||
#endif
|
||||
#else
|
||||
w5500_config.int_gpio_num = this->interrupt_pin_;
|
||||
#ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
|
||||
w5500_config.poll_period_ms = this->polling_interval_;
|
||||
#endif
|
||||
#endif
|
||||
// Install the custom SPI driver that offloads the bulk RX/TX frame transfers off the busy-wait
|
||||
// path. w5500_config (and the devcfg it references) outlives esp_eth_mac_new_w5500() below, which
|
||||
|
||||
@@ -32,16 +32,10 @@ void *w5500_custom_spi_init(const void *spi_config) {
|
||||
auto *ctx = &w5500_context;
|
||||
// The W5500 SPI frame carries the 16-bit address in the command phase and the 8-bit control
|
||||
// byte in the address phase; mirror what the stock driver configures.
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
|
||||
spi_device_interface_config_t devcfg = *config->base.spi_devcfg;
|
||||
const spi_host_device_t spi_host_id = config->base.spi_host_id;
|
||||
#else
|
||||
spi_device_interface_config_t devcfg = *config->spi_devcfg;
|
||||
const spi_host_device_t spi_host_id = config->spi_host_id;
|
||||
#endif
|
||||
devcfg.command_bits = 16;
|
||||
devcfg.address_bits = 8;
|
||||
if (spi_bus_add_device(spi_host_id, &devcfg, &ctx->handle) != ESP_OK) {
|
||||
if (spi_bus_add_device(config->spi_host_id, &devcfg, &ctx->handle) != ESP_OK) {
|
||||
ctx->handle = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -113,19 +107,11 @@ void install_w5500_async_spi(eth_w5500_config_t &config) {
|
||||
// Point the custom driver's config at the W5500 config itself; init() reads spi_host_id and
|
||||
// spi_devcfg back out of it. The self-reference is valid because both the config and the
|
||||
// spi_devcfg it points at outlive the esp_eth_mac_new_w5500() call that runs init().
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
|
||||
config.base.custom_spi_driver.config = &config;
|
||||
config.base.custom_spi_driver.init = w5500_custom_spi_init;
|
||||
config.base.custom_spi_driver.deinit = w5500_custom_spi_deinit;
|
||||
config.base.custom_spi_driver.read = w5500_custom_spi_read;
|
||||
config.base.custom_spi_driver.write = w5500_custom_spi_write;
|
||||
#else
|
||||
config.custom_spi_driver.config = &config;
|
||||
config.custom_spi_driver.init = w5500_custom_spi_init;
|
||||
config.custom_spi_driver.deinit = w5500_custom_spi_deinit;
|
||||
config.custom_spi_driver.read = w5500_custom_spi_read;
|
||||
config.custom_spi_driver.write = w5500_custom_spi_write;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace esphome::ethernet
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import logging
|
||||
|
||||
from esphome import pins
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import light
|
||||
@@ -37,8 +35,6 @@ from ._methods import (
|
||||
)
|
||||
from .const import CHIP_TYPES, CONF_ASYNC, CONF_BUS, ONE_WIRE_CHIPS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
neopixelbus_ns = cg.esphome_ns.namespace("neopixelbus")
|
||||
NeoPixelBusLightOutputBase = neopixelbus_ns.class_(
|
||||
"NeoPixelBusLightOutputBase", light.AddressableLight
|
||||
@@ -139,13 +135,12 @@ def _validate(config):
|
||||
return config
|
||||
|
||||
|
||||
def _warn_esp32_deprecated(config: ConfigType) -> ConfigType:
|
||||
def _reject_esp32(config: ConfigType) -> ConfigType:
|
||||
if CORE.is_esp32:
|
||||
_LOGGER.warning(
|
||||
"'neopixelbus' on ESP32 is deprecated. The upstream library "
|
||||
"(makuna/NeoPixelBus) is no longer actively maintained. Migrate "
|
||||
"to 'esp32_rmt_led_strip'. Removal is targeted for 2027.1 but "
|
||||
"may happen sooner once ESPHome moves to ESP-IDF 6."
|
||||
raise cv.Invalid(
|
||||
"'neopixelbus' is no longer supported on ESP32. Use the "
|
||||
"'esp32_rmt_led_strip' light platform instead: "
|
||||
"https://esphome.io/components/light/esp32_rmt_led_strip/"
|
||||
)
|
||||
return config
|
||||
|
||||
@@ -183,18 +178,10 @@ def _validate_method(value):
|
||||
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.only_with_framework(
|
||||
frameworks=Framework.ARDUINO,
|
||||
suggestions={
|
||||
Framework.ESP_IDF: (
|
||||
"esp32_rmt_led_strip",
|
||||
"light/esp32_rmt_led_strip",
|
||||
)
|
||||
},
|
||||
),
|
||||
_reject_esp32,
|
||||
cv.only_with_framework(frameworks=Framework.ARDUINO),
|
||||
cv.require_framework_version(
|
||||
esp8266_arduino=cv.Version(2, 4, 0),
|
||||
esp32_arduino=cv.Version(0, 0, 0),
|
||||
),
|
||||
light.ADDRESSABLE_LIGHT_SCHEMA.extend(
|
||||
{
|
||||
@@ -211,7 +198,6 @@ CONFIG_SCHEMA = cv.All(
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
_choose_default_method,
|
||||
_validate,
|
||||
_warn_esp32_deprecated,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ dependencies:
|
||||
rules:
|
||||
- if: "idf_version >=6.0.0 && target in [esp32, esp32p4]"
|
||||
espressif/w5500:
|
||||
version: "2.0.1"
|
||||
version: "1.0.1"
|
||||
rules:
|
||||
- if: "idf_version >=6.0.0"
|
||||
espressif/dm9051:
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
light:
|
||||
- platform: neopixelbus
|
||||
id: addr3
|
||||
name: Neopixelbus Light
|
||||
gamma_correct: 2.8
|
||||
color_correct: [0.0, 0.0, 0.0, 0.0]
|
||||
default_transition_length: 10s
|
||||
effects:
|
||||
- addressable_flicker:
|
||||
name: Flicker Effect With Custom Values
|
||||
update_interval: 16ms
|
||||
intensity: 5%
|
||||
type: GRBW
|
||||
variant: SK6812
|
||||
method: ESP32_I2S_0
|
||||
num_leds: 5
|
||||
pin: 4
|
||||
@@ -0,0 +1,82 @@
|
||||
esphome:
|
||||
name: lvgl-color-picker-render
|
||||
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# A snapshot never writes over an existing file, so the test supplies a new name each time.
|
||||
- action: take_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: picker_display
|
||||
filename: !lambda return name;
|
||||
- action: set_orange
|
||||
then:
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_sliders
|
||||
color: 0xFF8800
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_wheel
|
||||
color: 0xFF8800
|
||||
# White has no saturation, which a hue-only picker could never change again
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_hue
|
||||
color: 0xFFFFFF
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
- platform: snapshot
|
||||
id: picker_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 680
|
||||
height: 480
|
||||
|
||||
lvgl:
|
||||
displays: picker_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x404040
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 4
|
||||
layout:
|
||||
type: flex
|
||||
flex_flow: row_wrap
|
||||
pad_row: 4
|
||||
pad_column: 4
|
||||
widgets:
|
||||
- color_picker:
|
||||
id: picker_sliders
|
||||
width: 196
|
||||
color: 0x3366CC
|
||||
- color_picker:
|
||||
id: picker_wheel
|
||||
width: 196
|
||||
wheel: true
|
||||
color: 0x3366CC
|
||||
# Sized from the text font
|
||||
- color_picker:
|
||||
id: picker_content
|
||||
color: 0x3366CC
|
||||
# No red, green and blue bars beside the swatch
|
||||
- color_picker:
|
||||
id: picker_hsv
|
||||
width: 196
|
||||
sliders: hsv
|
||||
color: 0x3366CC
|
||||
# Only the hue bar
|
||||
- color_picker:
|
||||
id: picker_hue
|
||||
width: 196
|
||||
sliders: hue
|
||||
color: 0x3366CC
|
||||
@@ -0,0 +1,53 @@
|
||||
esphome:
|
||||
name: lvgl-headless-render-test
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# The name comes from the test so it can capture more than once: a snapshot never writes over
|
||||
# a file that is already there, so a fixed name could only ever be captured once.
|
||||
- action: take_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: lvgl_display
|
||||
filename: !lambda return name;
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
# A display with no screen, so what LVGL draws depends on LVGL alone - nothing about the machine
|
||||
# running the test, and no graphics library outside this repository, can move the result.
|
||||
- platform: snapshot
|
||||
id: lvgl_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
# The widgets are spelled out here rather than left to the built in "Hello World" screen, which
|
||||
# LVGL builds when nothing is configured: that screen contains a spinner, and an animation cannot
|
||||
# produce the same picture twice.
|
||||
#
|
||||
# Everything that affects the rendered pixels is set explicitly, so the expected hash in the test
|
||||
# depends only on the drawing code and the built in font. In particular the background comes from a
|
||||
# full screen object rather than from the theme, so adjusting a theme default does not break this.
|
||||
lvgl:
|
||||
displays: lvgl_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x000080
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 0
|
||||
widgets:
|
||||
- label:
|
||||
align: center
|
||||
text: "Hello World!"
|
||||
text_color: 0xFFFFFF
|
||||
@@ -1,126 +0,0 @@
|
||||
# Shared by test_lvgl_headless_render.py and test_lvgl_color_picker_render.py, so LVGL is compiled
|
||||
# once for both. Each test draws on its own display, driven by its own LVGL instance, at the size
|
||||
# its expected hashes were taken at.
|
||||
esphome:
|
||||
name: lvgl-render-test
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# The name comes from the test so it can capture more than once: a snapshot never writes over
|
||||
# a file that is already there, so a fixed name could only ever be captured once.
|
||||
- action: take_hello_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: hello_display
|
||||
filename: !lambda return name;
|
||||
- action: take_picker_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: picker_display
|
||||
filename: !lambda return name;
|
||||
- action: set_orange
|
||||
then:
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_sliders
|
||||
color: 0xFF8800
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_wheel
|
||||
color: 0xFF8800
|
||||
# White has no saturation, which a hue-only picker could never change again
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_hue
|
||||
color: 0xFFFFFF
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
# Displays with no screen, so what LVGL draws depends on LVGL alone - nothing about the machine
|
||||
# running the test, and no graphics library outside this repository, can move the result.
|
||||
- platform: snapshot
|
||||
id: hello_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 300
|
||||
height: 300
|
||||
- platform: snapshot
|
||||
id: picker_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 680
|
||||
height: 480
|
||||
|
||||
lvgl:
|
||||
# The widgets are spelled out here rather than left to the built in "Hello World" screen, which
|
||||
# LVGL builds when nothing is configured: that screen contains a spinner, and an animation cannot
|
||||
# produce the same picture twice.
|
||||
#
|
||||
# Everything that affects the rendered pixels is set explicitly, so the expected hash in the test
|
||||
# depends only on the drawing code and the built in font. In particular the background comes from
|
||||
# a full screen object rather than from the theme, so adjusting a theme default does not break it.
|
||||
- id: hello_lvgl
|
||||
displays: hello_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x000080
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 0
|
||||
widgets:
|
||||
- label:
|
||||
align: center
|
||||
text: "Hello World!"
|
||||
text_color: 0xFFFFFF
|
||||
|
||||
- id: picker_lvgl
|
||||
displays: picker_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x404040
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 4
|
||||
layout:
|
||||
type: flex
|
||||
flex_flow: row_wrap
|
||||
pad_row: 4
|
||||
pad_column: 4
|
||||
widgets:
|
||||
- color_picker:
|
||||
id: picker_sliders
|
||||
width: 196
|
||||
color: 0x3366CC
|
||||
- color_picker:
|
||||
id: picker_wheel
|
||||
width: 196
|
||||
wheel: true
|
||||
color: 0x3366CC
|
||||
# Sized from the text font
|
||||
- color_picker:
|
||||
id: picker_content
|
||||
color: 0x3366CC
|
||||
# No red, green and blue bars beside the swatch
|
||||
- color_picker:
|
||||
id: picker_hsv
|
||||
width: 196
|
||||
sliders: hsv
|
||||
color: 0x3366CC
|
||||
# Only the hue bar
|
||||
- color_picker:
|
||||
id: picker_hue
|
||||
width: 196
|
||||
sliders: hue
|
||||
color: 0x3366CC
|
||||
@@ -64,7 +64,6 @@ def _check(image: Bmp, capture: Path, expected: str, name: str) -> None:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.shared_yaml("lvgl_render")
|
||||
async def test_lvgl_color_picker_render(
|
||||
yaml_config: str,
|
||||
run_compiled: RunCompiledFunction,
|
||||
@@ -78,7 +77,7 @@ async def test_lvgl_color_picker_render(
|
||||
|
||||
async with run_compiled(yaml_config), api_client_connected() as client:
|
||||
_, services = await client.list_entities_services()
|
||||
take_screenshot = require_service(services, "take_picker_screenshot")
|
||||
take_screenshot = require_service(services, "take_screenshot")
|
||||
set_orange = require_service(services, "set_orange")
|
||||
|
||||
async def take(name: str) -> None:
|
||||
|
||||
@@ -35,7 +35,6 @@ EXPECTED_LVGL_VERSION = "9.6.0"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.shared_yaml("lvgl_render")
|
||||
async def test_lvgl_headless_render(
|
||||
yaml_config: str,
|
||||
run_compiled: RunCompiledFunction,
|
||||
@@ -49,7 +48,7 @@ async def test_lvgl_headless_render(
|
||||
|
||||
async with run_compiled(yaml_config), api_client_connected() as client:
|
||||
_, services = await client.list_entities_services()
|
||||
service = require_service(services, "take_hello_screenshot")
|
||||
service = require_service(services, "take_screenshot")
|
||||
|
||||
async def take(name: str) -> None:
|
||||
await client.execute_service(service, {"name": name})
|
||||
|
||||
Reference in new issue
Block a user