mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Allow UART debug configuration with no after: definition (#2753)
This commit is contained in:
parent
6226dae05c
commit
d30e2f2a4f
2 changed files with 13 additions and 3 deletions
|
@ -94,17 +94,21 @@ UART_DIRECTIONS = {
|
||||||
"BOTH": UARTDirection.UART_DIRECTION_BOTH,
|
"BOTH": UARTDirection.UART_DIRECTION_BOTH,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AFTER_DEFAULTS = {CONF_BYTES: 256, CONF_TIMEOUT: "100ms"}
|
||||||
|
|
||||||
DEBUG_SCHEMA = cv.Schema(
|
DEBUG_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(UARTDebugger),
|
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(UARTDebugger),
|
||||||
cv.Optional(CONF_DIRECTION, default="BOTH"): cv.enum(
|
cv.Optional(CONF_DIRECTION, default="BOTH"): cv.enum(
|
||||||
UART_DIRECTIONS, upper=True
|
UART_DIRECTIONS, upper=True
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_AFTER): cv.Schema(
|
cv.Optional(CONF_AFTER, default=AFTER_DEFAULTS): cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Optional(CONF_BYTES, default=256): cv.validate_bytes,
|
|
||||||
cv.Optional(
|
cv.Optional(
|
||||||
CONF_TIMEOUT, default="100ms"
|
CONF_BYTES, default=AFTER_DEFAULTS[CONF_BYTES]
|
||||||
|
): cv.validate_bytes,
|
||||||
|
cv.Optional(
|
||||||
|
CONF_TIMEOUT, default=AFTER_DEFAULTS[CONF_TIMEOUT]
|
||||||
): cv.positive_time_period_milliseconds,
|
): cv.positive_time_period_milliseconds,
|
||||||
cv.Optional(CONF_DELIMITER): cv.templatable(validate_raw_data),
|
cv.Optional(CONF_DELIMITER): cv.templatable(validate_raw_data),
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,12 @@ uart:
|
||||||
tx_pin: GPIO22
|
tx_pin: GPIO22
|
||||||
rx_pin: GPIO23
|
rx_pin: GPIO23
|
||||||
baud_rate: 115200
|
baud_rate: 115200
|
||||||
|
# Specifically added for testing debug with no after: definition.
|
||||||
|
debug:
|
||||||
|
dummy_receiver: false
|
||||||
|
direction: rx
|
||||||
|
sequence:
|
||||||
|
- lambda: UARTDebug::log_hex(direction, bytes, ':');
|
||||||
|
|
||||||
ota:
|
ota:
|
||||||
safe_mode: True
|
safe_mode: True
|
||||||
|
|
Loading…
Reference in a new issue