mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 19:18:09 +01:00
rename disabled to never
This commit is contained in:
parent
9bfcfa3684
commit
1c6bfb197e
1 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,7 @@ from esphome import pins
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.components import esp32, speaker
|
from esphome.components import esp32, speaker
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_CHANNEL, CONF_DISABLED, CONF_ID, CONF_MODE, CONF_TIMEOUT
|
from esphome.const import CONF_CHANNEL, CONF_ID, CONF_MODE, CONF_TIMEOUT
|
||||||
|
|
||||||
from .. import (
|
from .. import (
|
||||||
CONF_I2S_DOUT_PIN,
|
CONF_I2S_DOUT_PIN,
|
||||||
|
@ -27,6 +27,7 @@ I2SAudioSpeaker = i2s_audio_ns.class_(
|
||||||
CONF_BUFFER_DURATION = "buffer_duration"
|
CONF_BUFFER_DURATION = "buffer_duration"
|
||||||
CONF_DAC_TYPE = "dac_type"
|
CONF_DAC_TYPE = "dac_type"
|
||||||
CONF_I2S_COMM_FMT = "i2s_comm_fmt"
|
CONF_I2S_COMM_FMT = "i2s_comm_fmt"
|
||||||
|
CONF_NEVER = "never"
|
||||||
|
|
||||||
i2s_dac_mode_t = cg.global_ns.enum("i2s_dac_mode_t")
|
i2s_dac_mode_t = cg.global_ns.enum("i2s_dac_mode_t")
|
||||||
INTERNAL_DAC_OPTIONS = {
|
INTERNAL_DAC_OPTIONS = {
|
||||||
|
@ -77,7 +78,7 @@ BASE_SCHEMA = (
|
||||||
): cv.positive_time_period_milliseconds,
|
): cv.positive_time_period_milliseconds,
|
||||||
cv.Optional(CONF_TIMEOUT, default="500ms"): cv.Any(
|
cv.Optional(CONF_TIMEOUT, default="500ms"): cv.Any(
|
||||||
cv.positive_time_period_milliseconds,
|
cv.positive_time_period_milliseconds,
|
||||||
cv.one_of(CONF_DISABLED, lower=True),
|
cv.one_of(CONF_NEVER, lower=True),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -120,6 +121,6 @@ async def to_code(config):
|
||||||
else:
|
else:
|
||||||
cg.add(var.set_dout_pin(config[CONF_I2S_DOUT_PIN]))
|
cg.add(var.set_dout_pin(config[CONF_I2S_DOUT_PIN]))
|
||||||
cg.add(var.set_i2s_comm_fmt(config[CONF_I2S_COMM_FMT]))
|
cg.add(var.set_i2s_comm_fmt(config[CONF_I2S_COMM_FMT]))
|
||||||
if config[CONF_TIMEOUT] != CONF_DISABLED:
|
if config[CONF_TIMEOUT] != CONF_NEVER:
|
||||||
cg.add(var.set_timeout(config[CONF_TIMEOUT]))
|
cg.add(var.set_timeout(config[CONF_TIMEOUT]))
|
||||||
cg.add(var.set_buffer_duration(config[CONF_BUFFER_DURATION]))
|
cg.add(var.set_buffer_duration(config[CONF_BUFFER_DURATION]))
|
||||||
|
|
Loading…
Reference in a new issue