From 963e8e9be6f97d683f561af5a46d865f73978ded Mon Sep 17 00:00:00 2001 From: NeilSCGH Date: Sun, 17 Nov 2024 17:29:03 +0100 Subject: [PATCH] Bugfix --- .../waveshare_epaper/waveshare_epaper.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 5e2d835a8b..a2c08d4683 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -193,25 +193,22 @@ void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) { } uint8_t WaveshareEPaper7C::color_to_hex(Color color) { uint8_t hex_code; - if (color.red > 127) { - if (color.blue > 127) { - if (color.green > 127) { + if (color.green > 170) { + if (color.blue > 127) { hex_code = 0x1; // White } else { hex_code = 0x5; // Yellow } + } else if (color.green > 85) { + hex_code = 0x6; // Orange } else { - if (color.green > 85 && color.green < 170) { - hex_code = 0x6; // Orange - } else { - hex_code = 0x4; // Red - } + hex_code = 0x4; // Red (or Magenta) } } else { if (color.green > 127) { if (color.blue > 127) { - hex_code = 0x3; // Blue + hex_code = 0x3; // Cyan -> Blue } else { hex_code = 0x2; // Green }