Support for 4.2in v2 display. Board is marked as Rev 2.2

This commit is contained in:
Michael Davidson 2024-02-11 09:57:34 +11:00
parent 3eaf59cc5a
commit c6ce6ce016
No known key found for this signature in database
GPG key ID: B8D1A99712B8B0EB
3 changed files with 16 additions and 0 deletions

View file

@ -52,6 +52,9 @@ WaveshareEPaper4P2In = waveshare_epaper_ns.class_(
WaveshareEPaper4P2InBV2 = waveshare_epaper_ns.class_( WaveshareEPaper4P2InBV2 = waveshare_epaper_ns.class_(
"WaveshareEPaper4P2InBV2", WaveshareEPaper "WaveshareEPaper4P2InBV2", WaveshareEPaper
) )
WaveshareEPaper4P2InV2 = waveshare_epaper_ns.class_(
"WaveshareEPaper4P2InV2", WaveshareEPaper
)
WaveshareEPaper5P8In = waveshare_epaper_ns.class_( WaveshareEPaper5P8In = waveshare_epaper_ns.class_(
"WaveshareEPaper5P8In", WaveshareEPaper "WaveshareEPaper5P8In", WaveshareEPaper
) )
@ -109,6 +112,7 @@ MODELS = {
"2.90in-bv3": ("b", WaveshareEPaper2P9InBV3), "2.90in-bv3": ("b", WaveshareEPaper2P9InBV3),
"4.20in": ("b", WaveshareEPaper4P2In), "4.20in": ("b", WaveshareEPaper4P2In),
"4.20in-bv2": ("b", WaveshareEPaper4P2InBV2), "4.20in-bv2": ("b", WaveshareEPaper4P2InBV2),
"4.20in-v2": ("a", WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_4_2_IN_V2),
"5.83in": ("b", WaveshareEPaper5P8In), "5.83in": ("b", WaveshareEPaper5P8In),
"5.83inv2": ("b", WaveshareEPaper5P8InV2), "5.83inv2": ("b", WaveshareEPaper5P8InV2),
"7.50in": ("b", WaveshareEPaper7P5In), "7.50in": ("b", WaveshareEPaper7P5In),

View file

@ -219,6 +219,7 @@ void WaveshareEPaperTypeA::initialize() {
// More models can be added here to enable deep sleep if eligible // More models can be added here to enable deep sleep if eligible
case WAVESHARE_EPAPER_1_54_IN: case WAVESHARE_EPAPER_1_54_IN:
case WAVESHARE_EPAPER_1_54_IN_V2: case WAVESHARE_EPAPER_1_54_IN_V2:
case WAVESHARE_EPAPER_4_2_IN_V2:
this->deep_sleep_between_updates_ = true; this->deep_sleep_between_updates_ = true;
ESP_LOGI(TAG, "Set the display to deep sleep"); ESP_LOGI(TAG, "Set the display to deep sleep");
this->deep_sleep(); this->deep_sleep();
@ -272,6 +273,7 @@ void WaveshareEPaperTypeA::init_display_() {
break; break;
case TTGO_EPAPER_2_13_IN_B74: case TTGO_EPAPER_2_13_IN_B74:
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
case WAVESHARE_EPAPER_4_2_IN_V2:
this->data(0x03); // from top left to bottom right this->data(0x03); // from top left to bottom right
// RAM content option for Display Update // RAM content option for Display Update
this->command(0x21); this->command(0x21);
@ -312,6 +314,9 @@ void WaveshareEPaperTypeA::dump_config() {
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
ESP_LOGCONFIG(TAG, " Model: 2.9inV2"); ESP_LOGCONFIG(TAG, " Model: 2.9inV2");
break; break;
case WAVESHARE_EPAPER_4_2_IN_V2:
ESP_LOGCONFIG(TAG, " Model: 4.2inV2");
break;
} }
ESP_LOGCONFIG(TAG, " Full Update Every: %" PRIu32, this->full_update_every_); ESP_LOGCONFIG(TAG, " Full Update Every: %" PRIu32, this->full_update_every_);
LOG_PIN(" Reset Pin: ", this->reset_pin_); LOG_PIN(" Reset Pin: ", this->reset_pin_);
@ -435,6 +440,7 @@ void HOT WaveshareEPaperTypeA::display() {
this->command(0x22); this->command(0x22);
switch (this->model_) { switch (this->model_) {
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
case WAVESHARE_EPAPER_4_2_IN_V2:
case WAVESHARE_EPAPER_1_54_IN_V2: case WAVESHARE_EPAPER_1_54_IN_V2:
case TTGO_EPAPER_2_13_IN_B74: case TTGO_EPAPER_2_13_IN_B74:
this->data(full_update ? 0xF7 : 0xFF); this->data(full_update ? 0xF7 : 0xFF);
@ -473,6 +479,8 @@ int WaveshareEPaperTypeA::get_width_internal() {
case WAVESHARE_EPAPER_2_9_IN: case WAVESHARE_EPAPER_2_9_IN:
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
return 128; return 128;
case WAVESHARE_EPAPER_4_2_IN_V2:
return 400;
} }
return 0; return 0;
} }
@ -503,6 +511,8 @@ int WaveshareEPaperTypeA::get_height_internal() {
case WAVESHARE_EPAPER_2_9_IN: case WAVESHARE_EPAPER_2_9_IN:
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
return 296; return 296;
case WAVESHARE_EPAPER_4_2_IN_V2:
return 300;
} }
return 0; return 0;
} }

View file

@ -92,6 +92,7 @@ enum WaveshareEPaperTypeAModel {
WAVESHARE_EPAPER_2_13_IN, WAVESHARE_EPAPER_2_13_IN,
WAVESHARE_EPAPER_2_9_IN, WAVESHARE_EPAPER_2_9_IN,
WAVESHARE_EPAPER_2_9_IN_V2, WAVESHARE_EPAPER_2_9_IN_V2,
WAVESHARE_EPAPER_4_2_IN_V2,
TTGO_EPAPER_2_13_IN, TTGO_EPAPER_2_13_IN,
TTGO_EPAPER_2_13_IN_B73, TTGO_EPAPER_2_13_IN_B73,
TTGO_EPAPER_2_13_IN_B1, TTGO_EPAPER_2_13_IN_B1,
@ -114,6 +115,7 @@ class WaveshareEPaperTypeA : public WaveshareEPaper {
case WAVESHARE_EPAPER_1_54_IN: case WAVESHARE_EPAPER_1_54_IN:
case WAVESHARE_EPAPER_1_54_IN_V2: case WAVESHARE_EPAPER_1_54_IN_V2:
case WAVESHARE_EPAPER_2_9_IN_V2: case WAVESHARE_EPAPER_2_9_IN_V2:
case WAVESHARE_EPAPER_4_2_IN_V2:
// COMMAND DEEP SLEEP MODE // COMMAND DEEP SLEEP MODE
this->command(0x10); this->command(0x10);
this->data(0x01); this->data(0x01);