mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +01:00
Fix formatting
This commit is contained in:
parent
481e7ee74b
commit
232e36300a
2 changed files with 15 additions and 16 deletions
|
@ -169,16 +169,16 @@ void WaveshareEPaper::update() {
|
||||||
}
|
}
|
||||||
void WaveshareEPaper::fill(Color color) {
|
void WaveshareEPaper::fill(Color color) {
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
for (const auto& buf_color: this->get_supported_colors()) {
|
for (const auto &buf_color : this->get_supported_colors()) {
|
||||||
// A bit set to 1 means color is off
|
// A bit set to 1 means color is off
|
||||||
uint8_t value = 0x00;
|
uint8_t value = 0x00;
|
||||||
if (color != buf_color) {
|
if (color != buf_color) {
|
||||||
value = 0xFF;
|
value = 0xFF;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < (this->get_width_internal() * this->get_height_internal()) / 8u; i++) {
|
for (uint32_t i = 0; i < (this->get_width_internal() * this->get_height_internal()) / 8u; i++) {
|
||||||
this->buffer_[offset+i] = value;
|
this->buffer_[offset + i] = value;
|
||||||
}
|
}
|
||||||
offset+= (this->get_width_internal() * this->get_height_internal()) / 8u;
|
offset += (this->get_width_internal() * this->get_height_internal()) / 8u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void HOT WaveshareEPaper::draw_absolute_pixel_internal(int x, int y, Color color) {
|
void HOT WaveshareEPaper::draw_absolute_pixel_internal(int x, int y, Color color) {
|
||||||
|
@ -188,13 +188,13 @@ void HOT WaveshareEPaper::draw_absolute_pixel_internal(int x, int y, Color color
|
||||||
const uint32_t pos = (x + y * this->get_width_controller()) / 8u;
|
const uint32_t pos = (x + y * this->get_width_controller()) / 8u;
|
||||||
const uint8_t subpos = x & 0x07;
|
const uint8_t subpos = x & 0x07;
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
for (const auto& buf_color: this->get_supported_colors()) {
|
for (const auto &buf_color : this->get_supported_colors()) {
|
||||||
// A bit set to 1 means color is off
|
// A bit set to 1 means color is off
|
||||||
this->buffer_[offset+pos] &= ~(0x80 >> subpos);
|
this->buffer_[offset + pos] &= ~(0x80 >> subpos);
|
||||||
if (color != buf_color) {
|
if (color != buf_color) {
|
||||||
this->buffer_[offset+pos] |= 0x80 >> subpos;
|
this->buffer_[offset + pos] |= 0x80 >> subpos;
|
||||||
}
|
}
|
||||||
offset+= (this->get_width_internal() * this->get_height_internal()) / 8u;
|
offset += (this->get_width_internal() * this->get_height_internal()) / 8u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3138,7 +3138,7 @@ void WaveshareEPaper7In5BV2::power_on() {
|
||||||
void WaveshareEPaper7In5BV2::configure() {
|
void WaveshareEPaper7In5BV2::configure() {
|
||||||
// COMMAND PANEL SETTING
|
// COMMAND PANEL SETTING
|
||||||
this->command(0x00);
|
this->command(0x00);
|
||||||
this->data(0x0F); // //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
this->data(0x0F); // KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||||
// COMMAND RESOLUTION SETTING
|
// COMMAND RESOLUTION SETTING
|
||||||
this->command(0x61);
|
this->command(0x61);
|
||||||
this->data(0x03);
|
this->data(0x03);
|
||||||
|
@ -3167,14 +3167,14 @@ void HOT WaveshareEPaper7In5BV2::display() {
|
||||||
uint32_t buf_len = this->get_buffer_length_();
|
uint32_t buf_len = this->get_buffer_length_();
|
||||||
// COMMAND DATA START TRANSMISSION NEW DATA
|
// COMMAND DATA START TRANSMISSION NEW DATA
|
||||||
this->command(0x10);
|
this->command(0x10);
|
||||||
for (uint32_t i = 0; i < buf_len/2; i++) {
|
for (uint32_t i = 0; i < buf_len / 2; i++) {
|
||||||
this->data(this->buffer_[i]);
|
this->data(this->buffer_[i]);
|
||||||
}
|
}
|
||||||
this->command(0x92);
|
this->command(0x92);
|
||||||
|
|
||||||
// COMMAND DATA START TRANSMISSION NEW DATA
|
// COMMAND DATA START TRANSMISSION NEW DATA
|
||||||
this->command(0x13);
|
this->command(0x13);
|
||||||
for (uint32_t i = buf_len/2; i < buf_len; i++) {
|
for (uint32_t i = buf_len / 2; i < buf_len; i++) {
|
||||||
this->data(~this->buffer_[i]);
|
this->data(~this->buffer_[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -800,8 +800,7 @@ class WaveshareEPaperPolled : public WaveshareEPaper {
|
||||||
// Unused method from parent
|
// Unused method from parent
|
||||||
void initialize() override {}
|
void initialize() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Below are display steps, called one after the other by loop()
|
// Below are display steps, called one after the other by loop()
|
||||||
// Just implement these to support a new device.
|
// Just implement these to support a new device.
|
||||||
// Never sleep or wait in a step, the state machine will
|
// Never sleep or wait in a step, the state machine will
|
||||||
|
@ -822,8 +821,8 @@ protected:
|
||||||
// Set the screen to deep sleep
|
// Set the screen to deep sleep
|
||||||
void deep_sleep() override = 0;
|
void deep_sleep() override = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class State: uint8_t {
|
enum class State : uint8_t {
|
||||||
sleeping,
|
sleeping,
|
||||||
update_requested,
|
update_requested,
|
||||||
resetting,
|
resetting,
|
||||||
|
|
Loading…
Reference in a new issue