[remote_receiver] Size the RMT ring buffer from receive symbols by default (#19100)

This commit is contained in:
J. Nick Koston
2026-09-11 18:20:40 -05:00
committed by GitHub
parent 9f9df85aa0
commit ff9b2a1c83
8 changed files with 96 additions and 23 deletions
@@ -0,0 +1,10 @@
esphome:
name: test
esp32:
board: esp32dev
remote_receiver:
- id: rcvr
pin: GPIO4
buffer_size: 2kb
@@ -0,0 +1,12 @@
esphome:
name: test
esp32:
board: esp32-c2-devkitm-1
variant: esp32c2
framework:
type: esp-idf
remote_receiver:
- id: rcvr
pin: GPIO4
@@ -0,0 +1,9 @@
esphome:
name: test
esp8266:
board: d1_mini
remote_receiver:
- id: rcvr
pin: GPIO4
@@ -0,0 +1,28 @@
"""buffer_size reaches the receiver when set, and always on the pulse ring targets."""
from collections.abc import Callable
from pathlib import Path
def test_explicit_buffer_size_is_passed_through(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
) -> None:
main_cpp = generate_main(component_config_path("receiver_buffer_size.yaml"))
assert "rcvr->set_buffer_size(2000);" in main_cpp
def test_pulse_ring_target_keeps_a_default(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
) -> None:
main_cpp = generate_main(component_config_path("receiver_esp8266.yaml"))
assert "rcvr->set_buffer_size(1000);" in main_cpp
def test_esp32_variant_without_rmt_keeps_a_default(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
) -> None:
main_cpp = generate_main(component_config_path("receiver_esp32_c2.yaml"))
assert "rcvr->set_buffer_size(1000);" in main_cpp
@@ -27,7 +27,9 @@ def test_bare_receiver_emits_no_counts(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
) -> None:
generate_main(component_config_path("receiver_bare.yaml"))
main_cpp = generate_main(component_config_path("receiver_bare.yaml"))
# the RMT ring is sized in setup() unless buffer_size is set
assert "set_buffer_size" not in main_cpp
assert get_define_value("REMOTE_BASE_DUMPER_COUNT") is None
assert get_define_value("REMOTE_BASE_LISTENER_COUNT") is None