mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 15:28:34 +08:00
[epaper_spi] Fix deep sleep command (#15544)
This commit is contained in:
@@ -110,12 +110,14 @@ class EPaperBase : public Display,
|
|||||||
this->fill(COLOR_ON);
|
this->fill(COLOR_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
int get_height_internal() override { return this->height_; };
|
|
||||||
int get_width_internal() override { return this->width_; };
|
|
||||||
int get_width() override { return this->effective_transform_ & SWAP_XY ? this->height_ : this->width_; }
|
int get_width() override { return this->effective_transform_ & SWAP_XY ? this->height_ : this->width_; }
|
||||||
int get_height() override { return this->effective_transform_ & SWAP_XY ? this->width_ : this->height_; }
|
int get_height() override { return this->effective_transform_ & SWAP_XY ? this->width_ : this->height_; }
|
||||||
void draw_pixel_at(int x, int y, Color color) override;
|
void draw_pixel_at(int x, int y, Color color) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int get_height_internal() override { return this->height_; };
|
||||||
|
int get_width_internal() override { return this->width_; };
|
||||||
|
bool is_using_partial_update_() const { return this->full_update_every_ > 1; }
|
||||||
void process_state_();
|
void process_state_();
|
||||||
|
|
||||||
const char *epaper_state_to_string_();
|
const char *epaper_state_to_string_();
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ void EPaperMono::refresh_screen(bool partial) {
|
|||||||
|
|
||||||
void EPaperMono::deep_sleep() {
|
void EPaperMono::deep_sleep() {
|
||||||
ESP_LOGV(TAG, "Deep sleep");
|
ESP_LOGV(TAG, "Deep sleep");
|
||||||
this->command(0x10);
|
if (this->is_using_partial_update_()) {
|
||||||
|
this->cmd_data(0x10, {0x00}); // sleep in power on mode
|
||||||
|
} else {
|
||||||
|
this->cmd_data(0x10, {0x03}); // deep sleep
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EPaperMono::reset() {
|
bool EPaperMono::reset() {
|
||||||
@@ -27,6 +31,14 @@ bool EPaperMono::reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EPaperMono::set_window() {
|
void EPaperMono::set_window() {
|
||||||
|
// if not using partial update, the display will go into deep sleep, so must rewrite entire
|
||||||
|
// buffer since the display RAM will not retain contents
|
||||||
|
if (!this->is_using_partial_update_()) {
|
||||||
|
this->x_low_ = 0;
|
||||||
|
this->x_high_ = this->width_;
|
||||||
|
this->y_low_ = 0;
|
||||||
|
this->y_high_ = this->height_;
|
||||||
|
}
|
||||||
// round x-coordinates to byte boundaries
|
// round x-coordinates to byte boundaries
|
||||||
this->x_low_ &= ~7;
|
this->x_low_ &= ~7;
|
||||||
this->x_high_ += 7;
|
this->x_high_ += 7;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ display:
|
|||||||
model: seeed-reterminal-e1002
|
model: seeed-reterminal-e1002
|
||||||
- platform: epaper_spi
|
- platform: epaper_spi
|
||||||
model: seeed-ee04-mono-4.26
|
model: seeed-ee04-mono-4.26
|
||||||
|
full_update_every: 10
|
||||||
# Override pins to avoid conflict with other display configs
|
# Override pins to avoid conflict with other display configs
|
||||||
busy_pin: 43
|
busy_pin: 43
|
||||||
dc_pin: 42
|
dc_pin: 42
|
||||||
|
|||||||
Reference in New Issue
Block a user