This commit is contained in:
NeilSCGH 2024-11-17 17:29:03 +01:00
parent c81fd372aa
commit 963e8e9be6

View file

@ -193,25 +193,22 @@ 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) { if (color.red > 127) {
if (color.green > 170) {
if (color.blue > 127) { if (color.blue > 127) {
if (color.green > 127) {
hex_code = 0x1; // White hex_code = 0x1; // White
} else { } else {
hex_code = 0x5; // Yellow hex_code = 0x5; // Yellow
} }
} else { } else if (color.green > 85) {
if (color.green > 85 && color.green < 170) {
hex_code = 0x6; // Orange hex_code = 0x6; // Orange
} else { } else {
hex_code = 0x4; // Red hex_code = 0x4; // Red (or Magenta)
}
} }
} else { } else {
if (color.green > 127) { if (color.green > 127) {
if (color.blue > 127) { if (color.blue > 127) {
hex_code = 0x3; // Blue hex_code = 0x3; // Cyan -> Blue
} else { } else {
hex_code = 0x2; // Green hex_code = 0x2; // Green
} }