mirror of
https://github.com/esphome/esphome.git
synced 2026-09-12 15:57:33 +00:00
[remote_transmitter] Drop a transmit while the RMT is busy instead of queueing it
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
"""max_pending defaults to twice queue_depth and may not be smaller than it."""
|
||||
|
||||
import pytest
|
||||
|
||||
from esphome.components.remote_transmitter import (
|
||||
CONF_MAX_PENDING,
|
||||
CONF_QUEUE_DEPTH,
|
||||
_validate_queue,
|
||||
)
|
||||
import esphome.config_validation as cv
|
||||
|
||||
|
||||
def test_max_pending_defaults_to_twice_queue_depth() -> None:
|
||||
config = {CONF_QUEUE_DEPTH: 4}
|
||||
_validate_queue(config)
|
||||
assert config[CONF_MAX_PENDING] == 8
|
||||
|
||||
|
||||
def test_max_pending_explicit_is_kept() -> None:
|
||||
config = {CONF_QUEUE_DEPTH: 4, CONF_MAX_PENDING: 4}
|
||||
_validate_queue(config)
|
||||
assert config[CONF_MAX_PENDING] == 4
|
||||
|
||||
|
||||
def test_max_pending_below_queue_depth_is_rejected() -> None:
|
||||
with pytest.raises(cv.Invalid, match="max_pending must be at least queue_depth"):
|
||||
_validate_queue({CONF_QUEUE_DEPTH: 4, CONF_MAX_PENDING: 2})
|
||||
|
||||
|
||||
def test_no_queue_depth_without_rmt() -> None:
|
||||
config: dict[str, int] = {}
|
||||
_validate_queue(config)
|
||||
assert CONF_MAX_PENDING not in config
|
||||
@@ -5,8 +5,6 @@ remote_transmitter:
|
||||
non_blocking: true
|
||||
clock_resolution: ${clock_resolution}
|
||||
rmt_symbols: ${rmt_symbols}
|
||||
queue_depth: 4
|
||||
max_pending: 8
|
||||
|
||||
packages:
|
||||
buttons: !include common-buttons.yaml
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
substitutions:
|
||||
pin: GPIO2
|
||||
|
||||
remote_transmitter:
|
||||
- id: xmitr
|
||||
pin: ${pin}
|
||||
carrier_duty_percent: 50%
|
||||
non_blocking: true
|
||||
queue_depth: 1
|
||||
|
||||
packages:
|
||||
buttons: !include common-buttons.yaml
|
||||
Reference in New Issue
Block a user