Misc fixes for esp-idf (#2386)

This commit is contained in:
Otto Winter 2021-09-25 10:05:32 +02:00 committed by GitHub
parent d344b1ca0e
commit 5342edf04a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -176,13 +176,12 @@ void Logger::pre_setup() {
uart_num_ = UART_NUM_2; uart_num_ = UART_NUM_2;
break; break;
} }
uart_config_t uart_config = { uart_config_t uart_config{};
.baud_rate = (int) baud_rate_, uart_config.baud_rate = (int) baud_rate_;
.data_bits = UART_DATA_8_BITS, uart_config.data_bits = UART_DATA_8_BITS;
.parity = UART_PARITY_DISABLE, uart_config.parity = UART_PARITY_DISABLE;
.stop_bits = UART_STOP_BITS_1, uart_config.stop_bits = UART_STOP_BITS_1;
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
};
uart_param_config(uart_num_, &uart_config); uart_param_config(uart_num_, &uart_config);
const int uart_buffer_size = tx_buffer_size_; const int uart_buffer_size = tx_buffer_size_;
// Install UART driver using an event queue here // Install UART driver using an event queue here

View file

@ -247,6 +247,11 @@ async def _add_automations(config):
@coroutine_with_priority(100.0) @coroutine_with_priority(100.0)
async def to_code(config): async def to_code(config):
cg.add_global(cg.global_ns.namespace("esphome").using) cg.add_global(cg.global_ns.namespace("esphome").using)
# These can be used by user lambdas, put them to default scope
cg.add_global(cg.RawExpression("using std::isnan"))
cg.add_global(cg.RawExpression("using std::min"))
cg.add_global(cg.RawExpression("using std::max"))
cg.add( cg.add(
cg.App.pre_setup( cg.App.pre_setup(
config[CONF_NAME], config[CONF_NAME],