mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +01:00
Formatting
This commit is contained in:
parent
a4e9dfd4bf
commit
58b0d28904
1 changed files with 6 additions and 8 deletions
|
@ -187,7 +187,7 @@ void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
|||
this->buffers_[i] = allocator.allocate(small_buffer_length);
|
||||
if (this->buffers_[i] == nullptr) {
|
||||
ESP_LOGE(TAG, "Could not allocate buffer %d for display!", i);
|
||||
for (auto & buffer : this->buffers_) {
|
||||
for (auto &buffer : this->buffers_) {
|
||||
allocator.deallocate(buffer, small_buffer_length);
|
||||
buffer = nullptr;
|
||||
}
|
||||
|
@ -229,14 +229,13 @@ void WaveshareEPaper7C::fill(Color color) {
|
|||
ESP_LOGE(TAG, "Buffer unavailable!");
|
||||
} else {
|
||||
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
||||
for (auto & buffer : this->buffers_) {
|
||||
for (auto &buffer : this->buffers_) {
|
||||
for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
|
||||
// We store 8 bitset<3> in 3 bytes
|
||||
// | byte 1 | byte 2 | byte 3 |
|
||||
// |aaabbbaa|abbbaaab|bbaaabbb|
|
||||
buffer[buffer_pos + 0] = pixel_color << 5 | pixel_color << 2 | pixel_color >> 1;
|
||||
buffer[buffer_pos + 1] =
|
||||
pixel_color << 7 | pixel_color << 4 | pixel_color << 1 | pixel_color >> 2;
|
||||
buffer[buffer_pos + 1] = pixel_color << 7 | pixel_color << 4 | pixel_color << 1 | pixel_color >> 2;
|
||||
buffer[buffer_pos + 2] = pixel_color << 6 | pixel_color << 3 | pixel_color << 0;
|
||||
}
|
||||
App.feed_wdt();
|
||||
|
@ -2615,11 +2614,10 @@ void HOT WaveshareEPaper7P3InF::display() {
|
|||
this->command(0x10);
|
||||
uint32_t small_buffer_length = this->get_buffer_length_() / NUM_BUFFERS;
|
||||
uint8_t byte_to_send;
|
||||
for (auto & buffer : this->buffers_) {
|
||||
for (auto &buffer : this->buffers_) {
|
||||
for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
|
||||
std::bitset<24> triplet = buffer[buffer_pos + 0] << 16 |
|
||||
buffer[buffer_pos + 1] << 8 |
|
||||
buffer[buffer_pos + 2] << 0;
|
||||
std::bitset<24> triplet =
|
||||
buffer[buffer_pos + 0] << 16 | buffer[buffer_pos + 1] << 8 | buffer[buffer_pos + 2] << 0;
|
||||
// 8 bitset<3> are stored in 3 bytes
|
||||
// |aaabbbaa|abbbaaab|bbaaabbb|
|
||||
// | byte 1 | byte 2 | byte 3 |
|
||||
|
|
Loading…
Reference in a new issue