mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +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 WaveshareEPaper7C::color_to_hex(Color color) {
|
||||||
uint8_t hex_code;
|
uint8_t hex_code;
|
||||||
if (((color.red < 127) && (color.green < 127) && (color.blue < 127))) {
|
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))) {
|
} 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))) {
|
} 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))) {
|
} 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))) {
|
} 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))) {
|
} 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.red > 127) && (color.green > 64) && (color.green < 191) && (color.blue < 127))) {
|
||||||
hex_code = 0x6; //Orange
|
hex_code = 0x6; // Orange
|
||||||
} else {
|
} else {
|
||||||
hex_code = 0x1; //White
|
hex_code = 0x1; // White
|
||||||
}
|
}
|
||||||
return hex_code;
|
return hex_code;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ void HOT WaveshareEPaper7C::draw_absolute_pixel_internal(int x, int y, Color col
|
||||||
uint32_t buffer_position = byte_position / small_buffer_length;
|
uint32_t buffer_position = byte_position / small_buffer_length;
|
||||||
uint32_t buffer_subposition = byte_position % small_buffer_length;
|
uint32_t buffer_subposition = byte_position % small_buffer_length;
|
||||||
|
|
||||||
if (byte_subposition <= 5) {
|
if (byte_subposition <= 5) {
|
||||||
this->buffers_[buffer_position][buffer_subposition] =
|
this->buffers_[buffer_position][buffer_subposition] =
|
||||||
(this->buffers_[buffer_position][buffer_subposition] & (0xFF ^ (0b111 << (5 - byte_subposition)))) |
|
(this->buffers_[buffer_position][buffer_subposition] & (0xFF ^ (0b111 << (5 - byte_subposition)))) |
|
||||||
(pixel_bits << (5 - byte_subposition));
|
(pixel_bits << (5 - byte_subposition));
|
||||||
|
@ -2615,7 +2615,8 @@ void HOT WaveshareEPaper7P3InF::display() {
|
||||||
this->command(0x10);
|
this->command(0x10);
|
||||||
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
||||||
uint8_t byte_to_send;
|
uint8_t byte_to_send;
|
||||||
for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
|
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 |
|
std::bitset<24> triplet = this->buffers_[buffer_index][buffer_pos + 0] << 16 |
|
||||||
this->buffers_[buffer_index][buffer_pos + 1] << 8 |
|
this->buffers_[buffer_index][buffer_pos + 1] << 8 |
|
||||||
this->buffers_[buffer_index][buffer_pos + 2] << 0;
|
this->buffers_[buffer_index][buffer_pos + 2] << 0;
|
||||||
|
|
Loading…
Reference in a new issue