mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 05:54:56 +01:00
Add support for waveshare_epaper 1.54v2 (#1843)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
0db4815f3d
commit
8b737aabd9
3 changed files with 12 additions and 3 deletions
|
@ -46,6 +46,7 @@ WaveshareEPaperTypeBModel = waveshare_epaper_ns.enum("WaveshareEPaperTypeBModel"
|
|||
|
||||
MODELS = {
|
||||
"1.54in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_1_54_IN),
|
||||
"1.54inv2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_1_54_IN_V2),
|
||||
"2.13in": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_13_IN),
|
||||
"2.13in-ttgo": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN),
|
||||
"2.13in-ttgo-b1": ("a", WaveshareEPaperTypeAModel.TTGO_EPAPER_2_13_IN_B1),
|
||||
|
@ -67,7 +68,7 @@ def validate_full_update_every_only_type_a(value):
|
|||
if MODELS[value[CONF_MODEL]][0] != "a":
|
||||
raise cv.Invalid(
|
||||
"The 'full_update_every' option is only available for models "
|
||||
"'1.54in', '2.13in', '2.90in', and '2.90inV2'."
|
||||
"'1.54in', '1.54inV2', '2.13in', '2.90in', and '2.90inV2'."
|
||||
)
|
||||
return value
|
||||
|
||||
|
|
|
@ -210,6 +210,9 @@ void WaveshareEPaperTypeA::dump_config() {
|
|||
case WAVESHARE_EPAPER_1_54_IN:
|
||||
ESP_LOGCONFIG(TAG, " Model: 1.54in");
|
||||
break;
|
||||
case WAVESHARE_EPAPER_1_54_IN_V2:
|
||||
ESP_LOGCONFIG(TAG, " Model: 1.54inV2");
|
||||
break;
|
||||
case WAVESHARE_EPAPER_2_13_IN:
|
||||
ESP_LOGCONFIG(TAG, " Model: 2.13in");
|
||||
break;
|
||||
|
@ -334,7 +337,7 @@ void HOT WaveshareEPaperTypeA::display() {
|
|||
|
||||
// COMMAND DISPLAY UPDATE CONTROL 2
|
||||
this->command(0x22);
|
||||
if (this->model_ == WAVESHARE_EPAPER_2_9_IN_V2) {
|
||||
if (this->model_ == WAVESHARE_EPAPER_2_9_IN_V2 || this->model_ == WAVESHARE_EPAPER_1_54_IN_V2) {
|
||||
this->data(full_update ? 0xF7 : 0xFF);
|
||||
} else if (this->model_ == TTGO_EPAPER_2_13_IN_B73) {
|
||||
this->data(0xC7);
|
||||
|
@ -353,6 +356,8 @@ int WaveshareEPaperTypeA::get_width_internal() {
|
|||
switch (this->model_) {
|
||||
case WAVESHARE_EPAPER_1_54_IN:
|
||||
return 200;
|
||||
case WAVESHARE_EPAPER_1_54_IN_V2:
|
||||
return 200;
|
||||
case WAVESHARE_EPAPER_2_13_IN:
|
||||
return 128;
|
||||
case TTGO_EPAPER_2_13_IN:
|
||||
|
@ -372,6 +377,8 @@ int WaveshareEPaperTypeA::get_height_internal() {
|
|||
switch (this->model_) {
|
||||
case WAVESHARE_EPAPER_1_54_IN:
|
||||
return 200;
|
||||
case WAVESHARE_EPAPER_1_54_IN_V2:
|
||||
return 200;
|
||||
case WAVESHARE_EPAPER_2_13_IN:
|
||||
return 250;
|
||||
case TTGO_EPAPER_2_13_IN:
|
||||
|
|
|
@ -66,6 +66,7 @@ class WaveshareEPaper : public PollingComponent,
|
|||
|
||||
enum WaveshareEPaperTypeAModel {
|
||||
WAVESHARE_EPAPER_1_54_IN = 0,
|
||||
WAVESHARE_EPAPER_1_54_IN_V2,
|
||||
WAVESHARE_EPAPER_2_13_IN,
|
||||
WAVESHARE_EPAPER_2_9_IN,
|
||||
WAVESHARE_EPAPER_2_9_IN_V2,
|
||||
|
@ -85,7 +86,7 @@ class WaveshareEPaperTypeA : public WaveshareEPaper {
|
|||
void display() override;
|
||||
|
||||
void deep_sleep() override {
|
||||
if (this->model_ == WAVESHARE_EPAPER_2_9_IN_V2) {
|
||||
if (this->model_ == WAVESHARE_EPAPER_2_9_IN_V2 || this->model_ == WAVESHARE_EPAPER_1_54_IN_V2) {
|
||||
// COMMAND DEEP SLEEP MODE
|
||||
this->command(0x10);
|
||||
this->data(0x01);
|
||||
|
|
Loading…
Reference in a new issue