mirror of
https://github.com/esphome/esphome.git
synced 2025-08-03 17:07:54 +00:00
Merge remote-tracking branch 'upstream/dev' into integration
This commit is contained in:
commit
77a5430f00
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -246,30 +246,13 @@ jobs:
|
|||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pytest -vv --no-cov --tb=native -n auto tests/integration/
|
pytest -vv --no-cov --tb=native -n auto tests/integration/
|
||||||
|
|
||||||
clang-tidy-deps:
|
|
||||||
name: Clang-tidy dependencies
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
needs:
|
|
||||||
- common
|
|
||||||
- ci-custom
|
|
||||||
- pytest
|
|
||||||
- determine-jobs
|
|
||||||
if: |
|
|
||||||
always() &&
|
|
||||||
needs.determine-jobs.outputs.clang-tidy == 'true'
|
|
||||||
steps:
|
|
||||||
- run: echo "All clang-tidy dependencies ready"
|
|
||||||
|
|
||||||
clang-tidy:
|
clang-tidy:
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
needs:
|
needs:
|
||||||
- clang-tidy-deps
|
- common
|
||||||
- determine-jobs
|
- determine-jobs
|
||||||
if: |
|
if: needs.determine-jobs.outputs.clang-tidy == 'true'
|
||||||
always() &&
|
|
||||||
needs.determine-jobs.outputs.clang-tidy == 'true' &&
|
|
||||||
needs.clang-tidy-deps.result == 'success'
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
strategy:
|
strategy:
|
||||||
@ -502,7 +485,6 @@ jobs:
|
|||||||
- pylint
|
- pylint
|
||||||
- pytest
|
- pytest
|
||||||
- integration-tests
|
- integration-tests
|
||||||
- clang-tidy-deps
|
|
||||||
- clang-tidy
|
- clang-tidy
|
||||||
- determine-jobs
|
- determine-jobs
|
||||||
- test-build-components
|
- test-build-components
|
||||||
|
@ -177,6 +177,10 @@ optional<FanRestoreState> Fan::restore_state_() {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
void Fan::save_state_() {
|
void Fan::save_state_() {
|
||||||
|
if (this->restore_mode_ == FanRestoreMode::NO_RESTORE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FanRestoreState state{};
|
FanRestoreState state{};
|
||||||
state.state = this->state;
|
state.state = this->state;
|
||||||
state.oscillating = this->oscillating;
|
state.oscillating = this->oscillating;
|
||||||
|
@ -2,7 +2,7 @@ import logging
|
|||||||
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.components.const import CONF_REQUEST_HEADERS
|
from esphome.components.const import CONF_BYTE_ORDER, CONF_REQUEST_HEADERS
|
||||||
from esphome.components.http_request import CONF_HTTP_REQUEST_ID, HttpRequestComponent
|
from esphome.components.http_request import CONF_HTTP_REQUEST_ID, HttpRequestComponent
|
||||||
from esphome.components.image import (
|
from esphome.components.image import (
|
||||||
CONF_INVERT_ALPHA,
|
CONF_INVERT_ALPHA,
|
||||||
@ -11,6 +11,7 @@ from esphome.components.image import (
|
|||||||
Image_,
|
Image_,
|
||||||
get_image_type_enum,
|
get_image_type_enum,
|
||||||
get_transparency_enum,
|
get_transparency_enum,
|
||||||
|
validate_settings,
|
||||||
)
|
)
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
@ -161,6 +162,7 @@ CONFIG_SCHEMA = cv.Schema(
|
|||||||
rp2040_arduino=cv.Version(0, 0, 0),
|
rp2040_arduino=cv.Version(0, 0, 0),
|
||||||
host=cv.Version(0, 0, 0),
|
host=cv.Version(0, 0, 0),
|
||||||
),
|
),
|
||||||
|
validate_settings,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -213,6 +215,7 @@ async def to_code(config):
|
|||||||
get_image_type_enum(config[CONF_TYPE]),
|
get_image_type_enum(config[CONF_TYPE]),
|
||||||
transparent,
|
transparent,
|
||||||
config[CONF_BUFFER_SIZE],
|
config[CONF_BUFFER_SIZE],
|
||||||
|
config.get(CONF_BYTE_ORDER) != "LITTLE_ENDIAN",
|
||||||
)
|
)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
await cg.register_parented(var, config[CONF_HTTP_REQUEST_ID])
|
await cg.register_parented(var, config[CONF_HTTP_REQUEST_ID])
|
||||||
|
@ -35,14 +35,15 @@ inline bool is_color_on(const Color &color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OnlineImage::OnlineImage(const std::string &url, int width, int height, ImageFormat format, ImageType type,
|
OnlineImage::OnlineImage(const std::string &url, int width, int height, ImageFormat format, ImageType type,
|
||||||
image::Transparency transparency, uint32_t download_buffer_size)
|
image::Transparency transparency, uint32_t download_buffer_size, bool is_big_endian)
|
||||||
: Image(nullptr, 0, 0, type, transparency),
|
: Image(nullptr, 0, 0, type, transparency),
|
||||||
buffer_(nullptr),
|
buffer_(nullptr),
|
||||||
download_buffer_(download_buffer_size),
|
download_buffer_(download_buffer_size),
|
||||||
download_buffer_initial_size_(download_buffer_size),
|
download_buffer_initial_size_(download_buffer_size),
|
||||||
format_(format),
|
format_(format),
|
||||||
fixed_width_(width),
|
fixed_width_(width),
|
||||||
fixed_height_(height) {
|
fixed_height_(height),
|
||||||
|
is_big_endian_(is_big_endian) {
|
||||||
this->set_url(url);
|
this->set_url(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +297,7 @@ void OnlineImage::draw_pixel_(int x, int y, Color color) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ImageType::IMAGE_TYPE_GRAYSCALE: {
|
case ImageType::IMAGE_TYPE_GRAYSCALE: {
|
||||||
uint8_t gray = static_cast<uint8_t>(0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b);
|
auto gray = static_cast<uint8_t>(0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b);
|
||||||
if (this->transparency_ == image::TRANSPARENCY_CHROMA_KEY) {
|
if (this->transparency_ == image::TRANSPARENCY_CHROMA_KEY) {
|
||||||
if (gray == 1) {
|
if (gray == 1) {
|
||||||
gray = 0;
|
gray = 0;
|
||||||
@ -314,8 +315,13 @@ void OnlineImage::draw_pixel_(int x, int y, Color color) {
|
|||||||
case ImageType::IMAGE_TYPE_RGB565: {
|
case ImageType::IMAGE_TYPE_RGB565: {
|
||||||
this->map_chroma_key(color);
|
this->map_chroma_key(color);
|
||||||
uint16_t col565 = display::ColorUtil::color_to_565(color);
|
uint16_t col565 = display::ColorUtil::color_to_565(color);
|
||||||
this->buffer_[pos + 0] = static_cast<uint8_t>((col565 >> 8) & 0xFF);
|
if (this->is_big_endian_) {
|
||||||
this->buffer_[pos + 1] = static_cast<uint8_t>(col565 & 0xFF);
|
this->buffer_[pos + 0] = static_cast<uint8_t>((col565 >> 8) & 0xFF);
|
||||||
|
this->buffer_[pos + 1] = static_cast<uint8_t>(col565 & 0xFF);
|
||||||
|
} else {
|
||||||
|
this->buffer_[pos + 0] = static_cast<uint8_t>(col565 & 0xFF);
|
||||||
|
this->buffer_[pos + 1] = static_cast<uint8_t>((col565 >> 8) & 0xFF);
|
||||||
|
}
|
||||||
if (this->transparency_ == image::TRANSPARENCY_ALPHA_CHANNEL) {
|
if (this->transparency_ == image::TRANSPARENCY_ALPHA_CHANNEL) {
|
||||||
this->buffer_[pos + 2] = color.w;
|
this->buffer_[pos + 2] = color.w;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class OnlineImage : public PollingComponent,
|
|||||||
* @param buffer_size Size of the buffer used to download the image.
|
* @param buffer_size Size of the buffer used to download the image.
|
||||||
*/
|
*/
|
||||||
OnlineImage(const std::string &url, int width, int height, ImageFormat format, image::ImageType type,
|
OnlineImage(const std::string &url, int width, int height, ImageFormat format, image::ImageType type,
|
||||||
image::Transparency transparency, uint32_t buffer_size);
|
image::Transparency transparency, uint32_t buffer_size, bool is_big_endian);
|
||||||
|
|
||||||
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override;
|
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override;
|
||||||
|
|
||||||
@ -164,6 +164,11 @@ class OnlineImage : public PollingComponent,
|
|||||||
const int fixed_width_;
|
const int fixed_width_;
|
||||||
/** height requested on configuration, or 0 if non specified. */
|
/** height requested on configuration, or 0 if non specified. */
|
||||||
const int fixed_height_;
|
const int fixed_height_;
|
||||||
|
/**
|
||||||
|
* Whether the image is stored in big-endian format.
|
||||||
|
* This is used to determine how to store 16 bit colors in the buffer.
|
||||||
|
*/
|
||||||
|
bool is_big_endian_;
|
||||||
/**
|
/**
|
||||||
* Actual width of the current image. If fixed_width_ is specified,
|
* Actual width of the current image. If fixed_width_ is specified,
|
||||||
* this will be equal to it; otherwise it will be set once the decoding
|
* this will be equal to it; otherwise it will be set once the decoding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user