From 0efa34f32f1d30eae0f0f314d464867136e45db8 Mon Sep 17 00:00:00 2001 From: Guido Schreuder Date: Mon, 19 Feb 2024 23:22:57 +0100 Subject: [PATCH] more errors fixed --- esphome/components/ebus/ebus.cpp | 2 +- esphome/components/ebus/ebus.h | 16 +++++----------- esphome/components/ebus/ebus_component.cpp | 2 +- esphome/components/ebus/telegram.cpp | 9 +++++---- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/esphome/components/ebus/ebus.cpp b/esphome/components/ebus/ebus.cpp index e43bd2d090..26a0232b45 100644 --- a/esphome/components/ebus/ebus.cpp +++ b/esphome/components/ebus/ebus.cpp @@ -217,7 +217,7 @@ void Ebus::process_received_char(unsigned char received_byte) { this->handle_response_(this->receiving_telegram_); } -void Ebus::add_send_response_handler(const std::function& send_response_handler) { +void Ebus::add_send_response_handler(const std::function &send_response_handler) { send_response_handlers_.push_back(send_response_handler); } diff --git a/esphome/components/ebus/ebus.h b/esphome/components/ebus/ebus.h index c2a4fc7775..18ba794049 100644 --- a/esphome/components/ebus/ebus.h +++ b/esphome/components/ebus/ebus.h @@ -22,27 +22,21 @@ class Elf { class Ebus { public: - void set_primary_address(uint8_t primary_address) { - this->primary_address_ = primary_address; - } - void set_max_tries(uint8_t max_tries) { - this->max_tries_ = max_tries; - } - void set_max_lock_counter(uint8_t max_lock_counter) { - this->max_lock_counter_ = max_lock_counter; - } + void set_primary_address(uint8_t primary_address) { this->primary_address_ = primary_address; } + void set_max_tries(uint8_t max_tries) { this->max_tries_ = max_tries; } + void set_max_lock_counter(uint8_t max_lock_counter) { this->max_lock_counter_ = max_lock_counter; } void set_uart_send_function(std::function uart_send) { this->uart_send_ = std::move(uart_send); } void set_queue_received_telegram_function(std::function queue_received_telegram) { this->queue_received_telegram_ = std::move(queue_received_telegram); } - void set_dequeue_command_function(const std::function& dequeue_command) { + void set_dequeue_command_function(const std::function &dequeue_command) { this->dequeue_command_ = dequeue_command; } void process_received_char(unsigned char received_byte); - void add_send_response_handler(const std::function& send_response_handler); + void add_send_response_handler(const std::function &send_response_handler); protected: uint8_t primary_address_; diff --git a/esphome/components/ebus/ebus_component.cpp b/esphome/components/ebus/ebus_component.cpp index 0f732a5932..8fe4cb0095 100644 --- a/esphome/components/ebus/ebus_component.cpp +++ b/esphome/components/ebus/ebus_component.cpp @@ -89,7 +89,7 @@ void EbusComponent::setup_uart_() { .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .rx_flow_ctrl_thresh = 2, - .use_ref_tick = true, + .source_clk = UART_SCLK_REF_TICK, }; ESP_ERROR_CHECK(uart_param_config(this->uart_num_, &uart_config)); diff --git a/esphome/components/ebus/telegram.cpp b/esphome/components/ebus/telegram.cpp index 4368f9c741..a15bb8803f 100644 --- a/esphome/components/ebus/telegram.cpp +++ b/esphome/components/ebus/telegram.cpp @@ -79,13 +79,14 @@ uint8_t Telegram::get_response_crc() { return this->response_buffer_[RESPONSE_OF void Telegram::push_response_data(uint8_t cr) { this->push_buffer_(cr, response_buffer_, &response_buffer_pos_, &response_rolling_crc_, - RESPONSE_OFFSET + get_response_nn()); + RESPONSE_OFFSET + get_response_nn()); } bool Telegram::is_response_complete() { return (this->state_ > TelegramState::waitForSyn || this->state_ == TelegramState::endCompleted) && (this->response_buffer_pos_ > RESPONSE_OFFSET) && - (this->response_buffer_pos_ == (RESPONSE_OFFSET + this->get_response_nn() + 1)) && !this->wait_for_escaped_char_; + (this->response_buffer_pos_ == (RESPONSE_OFFSET + this->get_response_nn() + 1)) && + !this->wait_for_escaped_char_; } bool Telegram::is_response_valid() { @@ -94,8 +95,8 @@ bool Telegram::is_response_valid() { bool Telegram::is_request_complete() { return (this->state_ > TelegramState::waitForSyn || this->state_ == TelegramState::endCompleted) && - (this->request_buffer_pos_ > OFFSET_DATA) && (this->request_buffer_pos_ == (OFFSET_DATA + this->get_nn() + 1)) && - !this->wait_for_escaped_char_; + (this->request_buffer_pos_ > OFFSET_DATA) && + (this->request_buffer_pos_ == (OFFSET_DATA + this->get_nn() + 1)) && !this->wait_for_escaped_char_; } bool Telegram::is_request_valid() { return this->is_request_complete() && this->get_request_crc() == this->request_rolling_crc_;