mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Merge pull request #7732 from esphome/bump-2024.10.3
Some checks failed
CI / Create common environment (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / Check black (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / CI Status (push) Has been cancelled
Some checks failed
CI / Create common environment (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / Check black (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / CI Status (push) Has been cancelled
2024.10.3
This commit is contained in:
commit
b8eadb2ba5
6 changed files with 54 additions and 18 deletions
|
@ -60,9 +60,10 @@ class AnimimgType(WidgetType):
|
||||||
lvgl_components_required.add(CONF_IMAGE)
|
lvgl_components_required.add(CONF_IMAGE)
|
||||||
lvgl_components_required.add(CONF_ANIMIMG)
|
lvgl_components_required.add(CONF_ANIMIMG)
|
||||||
if CONF_SRC in config:
|
if CONF_SRC in config:
|
||||||
for x in config[CONF_SRC]:
|
srcs = [
|
||||||
await cg.get_variable(x)
|
await lv_image.process(await cg.get_variable(x))
|
||||||
srcs = [await lv_image.process(x) for x in config[CONF_SRC]]
|
for x in config[CONF_SRC]
|
||||||
|
]
|
||||||
src_id = cg.static_const_array(config[CONF_SRC_LIST_ID], srcs)
|
src_id = cg.static_const_array(config[CONF_SRC_LIST_ID], srcs)
|
||||||
count = len(config[CONF_SRC])
|
count = len(config[CONF_SRC])
|
||||||
lv.animimg_set_src(w.obj, src_id, count)
|
lv.animimg_set_src(w.obj, src_id, count)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ANGLE, CONF_MODE
|
from esphome.const import CONF_ANGLE, CONF_MODE
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ class ImgType(WidgetType):
|
||||||
|
|
||||||
async def to_code(self, w: Widget, config):
|
async def to_code(self, w: Widget, config):
|
||||||
if src := config.get(CONF_SRC):
|
if src := config.get(CONF_SRC):
|
||||||
|
src = await cg.get_variable(src)
|
||||||
lv.img_set_src(w.obj, await lv_image.process(src))
|
lv.img_set_src(w.obj, await lv_image.process(src))
|
||||||
if (cf_angle := config.get(CONF_ANGLE)) is not None:
|
if (cf_angle := config.get(CONF_ANGLE)) is not None:
|
||||||
pivot_x = config[CONF_PIVOT_X]
|
pivot_x = config[CONF_PIVOT_X]
|
||||||
|
|
|
@ -15,31 +15,41 @@ void Modbus::setup() {
|
||||||
void Modbus::loop() {
|
void Modbus::loop() {
|
||||||
const uint32_t now = millis();
|
const uint32_t now = millis();
|
||||||
|
|
||||||
if (now - this->last_modbus_byte_ > 50) {
|
|
||||||
this->rx_buffer_.clear();
|
|
||||||
this->last_modbus_byte_ = now;
|
|
||||||
}
|
|
||||||
// stop blocking new send commands after send_wait_time_ ms regardless if a response has been received since then
|
|
||||||
if (now - this->last_send_ > send_wait_time_) {
|
|
||||||
waiting_for_response = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (this->available()) {
|
while (this->available()) {
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
this->read_byte(&byte);
|
this->read_byte(&byte);
|
||||||
if (this->parse_modbus_byte_(byte)) {
|
if (this->parse_modbus_byte_(byte)) {
|
||||||
this->last_modbus_byte_ = now;
|
this->last_modbus_byte_ = now;
|
||||||
} else {
|
} else {
|
||||||
|
size_t at = this->rx_buffer_.size();
|
||||||
|
if (at > 0) {
|
||||||
|
ESP_LOGV(TAG, "Clearing buffer of %d bytes - parse failed", at);
|
||||||
this->rx_buffer_.clear();
|
this->rx_buffer_.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (now - this->last_modbus_byte_ > 50) {
|
||||||
|
size_t at = this->rx_buffer_.size();
|
||||||
|
if (at > 0) {
|
||||||
|
ESP_LOGV(TAG, "Clearing buffer of %d bytes - timeout", at);
|
||||||
|
this->rx_buffer_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop blocking new send commands after sent_wait_time_ ms after response received
|
||||||
|
if (now - this->last_send_ > send_wait_time_) {
|
||||||
|
if (waiting_for_response > 0)
|
||||||
|
ESP_LOGV(TAG, "Stop waiting for response from %d", waiting_for_response);
|
||||||
|
waiting_for_response = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||||
size_t at = this->rx_buffer_.size();
|
size_t at = this->rx_buffer_.size();
|
||||||
this->rx_buffer_.push_back(byte);
|
this->rx_buffer_.push_back(byte);
|
||||||
const uint8_t *raw = &this->rx_buffer_[0];
|
const uint8_t *raw = &this->rx_buffer_[0];
|
||||||
ESP_LOGV(TAG, "Modbus received Byte %d (0X%x)", byte, byte);
|
ESP_LOGVV(TAG, "Modbus received Byte %d (0X%x)", byte, byte);
|
||||||
// Byte 0: modbus address (match all)
|
// Byte 0: modbus address (match all)
|
||||||
if (at == 0)
|
if (at == 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -144,8 +154,10 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||||
ESP_LOGW(TAG, "Got Modbus frame from unknown address 0x%02X! ", address);
|
ESP_LOGW(TAG, "Got Modbus frame from unknown address 0x%02X! ", address);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return false to reset buffer
|
// reset buffer
|
||||||
return false;
|
ESP_LOGV(TAG, "Clearing buffer of %d bytes - parse succeeded", at);
|
||||||
|
this->rx_buffer_.clear();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Modbus::dump_config() {
|
void Modbus::dump_config() {
|
||||||
|
|
|
@ -84,6 +84,26 @@ void RpiDpiRgb::draw_pixels_at(int x_start, int y_start, int w, int h, const uin
|
||||||
ESP_LOGE(TAG, "lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
|
ESP_LOGE(TAG, "lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RpiDpiRgb::get_width() {
|
||||||
|
switch (this->rotation_) {
|
||||||
|
case display::DISPLAY_ROTATION_90_DEGREES:
|
||||||
|
case display::DISPLAY_ROTATION_270_DEGREES:
|
||||||
|
return this->get_height_internal();
|
||||||
|
default:
|
||||||
|
return this->get_width_internal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int RpiDpiRgb::get_height() {
|
||||||
|
switch (this->rotation_) {
|
||||||
|
case display::DISPLAY_ROTATION_90_DEGREES:
|
||||||
|
case display::DISPLAY_ROTATION_270_DEGREES:
|
||||||
|
return this->get_width_internal();
|
||||||
|
default:
|
||||||
|
return this->get_height_internal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RpiDpiRgb::draw_pixel_at(int x, int y, Color color) {
|
void RpiDpiRgb::draw_pixel_at(int x, int y, Color color) {
|
||||||
if (!this->get_clipping().inside(x, y))
|
if (!this->get_clipping().inside(x, y))
|
||||||
return; // NOLINT
|
return; // NOLINT
|
||||||
|
|
|
@ -24,6 +24,7 @@ class RpiDpiRgb : public display::Display {
|
||||||
void update() override { this->do_update_(); }
|
void update() override { this->do_update_(); }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||||
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
||||||
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
||||||
void draw_pixel_at(int x, int y, Color color) override;
|
void draw_pixel_at(int x, int y, Color color) override;
|
||||||
|
@ -44,8 +45,8 @@ class RpiDpiRgb : public display::Display {
|
||||||
this->width_ = width;
|
this->width_ = width;
|
||||||
this->height_ = height;
|
this->height_ = height;
|
||||||
}
|
}
|
||||||
int get_width() override { return this->width_; }
|
int get_width() override;
|
||||||
int get_height() override { return this->height_; }
|
int get_height() override;
|
||||||
void set_hsync_back_porch(uint16_t hsync_back_porch) { this->hsync_back_porch_ = hsync_back_porch; }
|
void set_hsync_back_porch(uint16_t hsync_back_porch) { this->hsync_back_porch_ = hsync_back_porch; }
|
||||||
void set_hsync_front_porch(uint16_t hsync_front_porch) { this->hsync_front_porch_ = hsync_front_porch; }
|
void set_hsync_front_porch(uint16_t hsync_front_porch) { this->hsync_front_porch_ = hsync_front_porch; }
|
||||||
void set_hsync_pulse_width(uint16_t hsync_pulse_width) { this->hsync_pulse_width_ = hsync_pulse_width; }
|
void set_hsync_pulse_width(uint16_t hsync_pulse_width) { this->hsync_pulse_width_ = hsync_pulse_width; }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2024.10.2"
|
__version__ = "2024.10.3"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
|
Loading…
Reference in a new issue