mirror of
https://github.com/esphome/esphome.git
synced 2025-03-01 00:08:15 +00:00
Bugfix
This commit is contained in:
parent
e6dc8f9910
commit
db2abab361
@ -198,23 +198,37 @@ void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
|||||||
}
|
}
|
||||||
uint8_t WaveshareEPaper7C::color_to_hex(Color color) {
|
uint8_t WaveshareEPaper7C::color_to_hex(Color color) {
|
||||||
uint8_t hex_code;
|
uint8_t hex_code;
|
||||||
if (((color.red < 127) && (color.green < 127) && (color.blue < 127))) {
|
|
||||||
hex_code = 0x0; // Black
|
if (color.red > 127) {
|
||||||
} else if (((color.red > 127) && (color.green > 127) && (color.blue > 127))) {
|
if (color.blue > 127) {
|
||||||
|
if (color.green > 127) {
|
||||||
hex_code = 0x1; // White
|
hex_code = 0x1; // White
|
||||||
} else if (((color.red < 127) && (color.green > 127) && (color.blue < 127))) {
|
} else {
|
||||||
hex_code = 0x2; // Green
|
|
||||||
} else if (((color.red < 127) && (color.green < 127) && (color.blue > 127))) {
|
|
||||||
hex_code = 0x3; // Blue
|
|
||||||
} else if (((color.red > 127) && (color.green < 127) && (color.blue < 127))) {
|
|
||||||
hex_code = 0x4; // Red
|
|
||||||
} else if (((color.red > 127) && (color.green > 127) && (color.blue < 127))) {
|
|
||||||
hex_code = 0x5; // Yellow
|
hex_code = 0x5; // Yellow
|
||||||
} else if (((color.red > 127) && (color.green > 64) && (color.green < 191) && (color.blue < 127))) {
|
}
|
||||||
|
} else {
|
||||||
|
if (color.green > 85 && color.green < 170 ) {
|
||||||
hex_code = 0x6; // Orange
|
hex_code = 0x6; // Orange
|
||||||
} else {
|
} else {
|
||||||
hex_code = 0x1; // White
|
hex_code = 0x4; // Red
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (color.green > 127) {
|
||||||
|
if (color.blue > 127) {
|
||||||
|
hex_code = 0x3; // Blue
|
||||||
|
} else {
|
||||||
|
hex_code = 0x2; // Green
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (color.blue > 127) {
|
||||||
|
hex_code = 0x3; // Blue
|
||||||
|
} else {
|
||||||
|
hex_code = 0x0; // Black
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hex_code;
|
return hex_code;
|
||||||
}
|
}
|
||||||
void WaveshareEPaper7C::fill(Color color) {
|
void WaveshareEPaper7C::fill(Color color) {
|
||||||
@ -225,7 +239,7 @@ void WaveshareEPaper7C::fill(Color color) {
|
|||||||
pixel_color = 0x1;
|
pixel_color = 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->buffers_ == nullptr) {
|
if (this->buffers_[0] == nullptr) {
|
||||||
ESP_LOGE(TAG, "Buffer unavailable!");
|
ESP_LOGE(TAG, "Buffer unavailable!");
|
||||||
} else {
|
} else {
|
||||||
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
||||||
@ -2496,7 +2510,7 @@ void WaveshareEPaper7P5In::dump_config() {
|
|||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
void WaveshareEPaper7P3InF::initialize() {
|
void WaveshareEPaper7P3InF::initialize() {
|
||||||
if (this->buffers_ == nullptr) {
|
if (this->buffers_[0] == nullptr) {
|
||||||
ESP_LOGE(TAG, "Buffer unavailable!");
|
ESP_LOGE(TAG, "Buffer unavailable!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2599,11 +2613,10 @@ void WaveshareEPaper7P3InF::initialize() {
|
|||||||
ESP_LOGI(TAG, "Display initialized successfully");
|
ESP_LOGI(TAG, "Display initialized successfully");
|
||||||
}
|
}
|
||||||
void HOT WaveshareEPaper7P3InF::display() {
|
void HOT WaveshareEPaper7P3InF::display() {
|
||||||
if (this->buffers_ == nullptr) {
|
if (this->buffers_[0] == nullptr) {
|
||||||
ESP_LOGE(TAG, "Buffer unavailable!");
|
ESP_LOGE(TAG, "Buffer unavailable!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t buf_len = this->get_buffer_length_();
|
|
||||||
|
|
||||||
// INITIALIZATION
|
// INITIALIZATION
|
||||||
ESP_LOGI(TAG, "Initialise the display");
|
ESP_LOGI(TAG, "Initialise the display");
|
||||||
|
@ -289,6 +289,7 @@ class GDEW0154M09 : public WaveshareEPaper {
|
|||||||
void display() override;
|
void display() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void deep_sleep() override;
|
void deep_sleep() override;
|
||||||
|
using WaveshareEPaper::init_internal_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int get_width_internal() override;
|
int get_width_internal() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user