mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
Bug fix
This commit is contained in:
parent
db2abab361
commit
2bfb9573e3
2 changed files with 2 additions and 10 deletions
|
@ -175,11 +175,6 @@ void WaveshareEPaper::fill(Color color) {
|
||||||
this->buffer_[i] = fill;
|
this->buffer_[i] = fill;
|
||||||
}
|
}
|
||||||
void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) {
|
||||||
if (heap_caps_get_free_size(MALLOC_CAP_INTERNAL) < buffer_length) {
|
|
||||||
ESP_LOGE(TAG, "Could not allocate buffers, not enough ram!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
|
||||||
uint32_t small_buffer_length = buffer_length / NUM_BUFFERS;
|
uint32_t small_buffer_length = buffer_length / NUM_BUFFERS;
|
||||||
|
|
||||||
|
@ -207,7 +202,7 @@ uint8_t WaveshareEPaper7C::color_to_hex(Color color) {
|
||||||
hex_code = 0x5; // Yellow
|
hex_code = 0x5; // Yellow
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (color.green > 85 && color.green < 170 ) {
|
if (color.green > 85 && color.green < 170) {
|
||||||
hex_code = 0x6; // Orange
|
hex_code = 0x6; // Orange
|
||||||
} else {
|
} else {
|
||||||
hex_code = 0x4; // Red
|
hex_code = 0x4; // Red
|
||||||
|
|
|
@ -62,8 +62,6 @@ class WaveshareEPaperBase : public display::DisplayBuffer,
|
||||||
GPIOPin *dc_pin_;
|
GPIOPin *dc_pin_;
|
||||||
GPIOPin *busy_pin_{nullptr};
|
GPIOPin *busy_pin_{nullptr};
|
||||||
virtual uint32_t idle_timeout_() { return 1000u; } // NOLINT(readability-identifier-naming)
|
virtual uint32_t idle_timeout_() { return 1000u; } // NOLINT(readability-identifier-naming)
|
||||||
|
|
||||||
virtual void init_internal_(uint32_t buffer_length);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveshareEPaper : public WaveshareEPaperBase {
|
class WaveshareEPaper : public WaveshareEPaperBase {
|
||||||
|
@ -98,7 +96,7 @@ class WaveshareEPaper7C : public WaveshareEPaperBase {
|
||||||
protected:
|
protected:
|
||||||
void draw_absolute_pixel_internal(int x, int y, Color color) override;
|
void draw_absolute_pixel_internal(int x, int y, Color color) override;
|
||||||
uint32_t get_buffer_length_() override;
|
uint32_t get_buffer_length_() override;
|
||||||
void init_internal_(uint32_t buffer_length) override;
|
void init_internal_(uint32_t buffer_length);
|
||||||
|
|
||||||
static const int NUM_BUFFERS = 10;
|
static const int NUM_BUFFERS = 10;
|
||||||
uint8_t *buffers_[NUM_BUFFERS];
|
uint8_t *buffers_[NUM_BUFFERS];
|
||||||
|
@ -289,7 +287,6 @@ class GDEW0154M09 : public WaveshareEPaper {
|
||||||
void display() override;
|
void display() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void deep_sleep() override;
|
void deep_sleep() override;
|
||||||
using WaveshareEPaper::init_internal_;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int get_width_internal() override;
|
int get_width_internal() override;
|
||||||
|
|
Loading…
Reference in a new issue