Update the patched UART component to ESPHome 2026.11.0
ESPHome 2026.11's tuya component calls uart.new_uart_component(), which the 2026.10.2 copy didn't have, so the build failed. Copy the UART component from 2026.11.0, reapply the PA13/PA14 patch, regenerate the patch file and point the refs at v1.0.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bcc6b3a42b
commit
1457e25d98
39 files changed
+907
-304
No files matched your search
@@ -1,10 +1,10 @@
|
||||
#include "uart_event.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
static const char *const TAG = "uart.event";
|
||||
ESPHOME_LOG_TAG(TAG, "uart.event");
|
||||
|
||||
void UARTEvent::setup() {}
|
||||
|
||||
@@ -12,26 +12,23 @@ void UARTEvent::dump_config() { LOG_EVENT("", "UART Event", this); }
|
||||
|
||||
void UARTEvent::loop() { this->read_data_(); }
|
||||
|
||||
void UARTEvent::add_event_matcher(const char *event_name, const uint8_t *match_data, size_t match_data_len) {
|
||||
this->matchers_.push_back({event_name, match_data, match_data_len});
|
||||
if (match_data_len > this->max_matcher_len_) {
|
||||
this->max_matcher_len_ = match_data_len;
|
||||
}
|
||||
}
|
||||
|
||||
void UARTEvent::read_data_() {
|
||||
while (this->available()) {
|
||||
uint8_t data;
|
||||
this->read_byte(&data);
|
||||
this->read_available([this](uint8_t data) {
|
||||
this->buffer_.push_back(data);
|
||||
|
||||
bool match_found = false;
|
||||
for (const auto &matcher : this->matchers_) {
|
||||
for (uint16_t i = 0; i < this->matcher_count_; i++) {
|
||||
const UARTEventMatcher &matcher = this->matchers_[i];
|
||||
if (this->buffer_.size() < matcher.data_len) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (std::equal(matcher.data, matcher.data + matcher.data_len, this->buffer_.end() - matcher.data_len)) {
|
||||
const uint8_t *tail = this->buffer_.data() + this->buffer_.size() - matcher.data_len;
|
||||
size_t pos = 0;
|
||||
// The pattern is in flash; ESP8266 only allows word loads there, so read it with progmem_read_byte
|
||||
while (pos < matcher.data_len && progmem_read_byte(matcher.data + pos) == tail[pos])
|
||||
pos++;
|
||||
if (pos == matcher.data_len) {
|
||||
this->trigger(matcher.event_name);
|
||||
this->buffer_.clear();
|
||||
match_found = true;
|
||||
@@ -42,7 +39,7 @@ void UARTEvent::read_data_() {
|
||||
if (!match_found && this->max_matcher_len_ > 0 && this->buffer_.size() > this->max_matcher_len_) {
|
||||
this->buffer_.erase(this->buffer_.begin());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace esphome::uart
|
||||
Reference in new issue
Block a user