mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Formatting
This commit is contained in:
parent
7d6622be61
commit
208edf543a
1 changed files with 12 additions and 11 deletions
|
@ -199,21 +199,21 @@ void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
|||
uint8_t WaveshareEPaper7C::color_to_hex(Color color) {
|
||||
uint8_t hex_code;
|
||||
if (((color.red < 127) && (color.green < 127) && (color.blue < 127))) {
|
||||
hex_code = 0x0; //Black
|
||||
hex_code = 0x0; // Black
|
||||
} else if (((color.red > 127) && (color.green > 127) && (color.blue > 127))) {
|
||||
hex_code = 0x1; //White
|
||||
hex_code = 0x1; // White
|
||||
} else if (((color.red < 127) && (color.green > 127) && (color.blue < 127))) {
|
||||
hex_code = 0x2; //Green
|
||||
hex_code = 0x2; // Green
|
||||
} else if (((color.red < 127) && (color.green < 127) && (color.blue > 127))) {
|
||||
hex_code = 0x3; //Blue
|
||||
hex_code = 0x3; // Blue
|
||||
} else if (((color.red > 127) && (color.green < 127) && (color.blue < 127))) {
|
||||
hex_code = 0x4; //Red
|
||||
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))) {
|
||||
hex_code = 0x6; //Orange
|
||||
hex_code = 0x6; // Orange
|
||||
} else {
|
||||
hex_code = 0x1; //White
|
||||
hex_code = 0x1; // White
|
||||
}
|
||||
return hex_code;
|
||||
}
|
||||
|
@ -2615,6 +2615,7 @@ void HOT WaveshareEPaper7P3InF::display() {
|
|||
this->command(0x10);
|
||||
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
||||
uint8_t byte_to_send;
|
||||
for (int buffer_index = 0; buffer_index < NUM_BUFFERS; buffer_index++) {
|
||||
for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
|
||||
std::bitset<24> triplet = this->buffers_[buffer_index][buffer_pos + 0] << 16 |
|
||||
this->buffers_[buffer_index][buffer_pos + 1] << 8 |
|
||||
|
|
Loading…
Reference in a new issue