mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
[rpi_dpi_rgb] Fix get_width and height (Bugfix) (#7675)
Some checks failed
CI / Create common environment (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / CI Status (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 / 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 / Test split components (push) Has been cancelled
Some checks failed
CI / Create common environment (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / CI Status (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 / 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 / Test split components (push) Has been cancelled
Co-authored-by: clydeps <U5yx99dok9>
This commit is contained in:
parent
34de2bbe99
commit
1e2497748d
2 changed files with 23 additions and 2 deletions
|
@ -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; }
|
||||||
|
|
Loading…
Reference in a new issue