diff --git a/boards/heltec_vision_master_e290.json b/boards/heltec_vision_master_e290.json new file mode 100644 index 000000000..70f7d5f02 --- /dev/null +++ b/boards/heltec_vision_master_e290.json @@ -0,0 +1,42 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_8MB.csv" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=0", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + ["0x303A", "0x1001"], + ["0x303A", "0x0002"] + ], + "mcu": "esp32s3", + "variant": "heltec_vision_master_e290" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "name": "Heltec Vision Master E290", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://heltec.org/project/vision-master-e290/", + "vendor": "Heltec" +} diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 54fd1ea4d..633fb4c67 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1902,6 +1902,13 @@ int32_t Screen::runOnce() // standard screen loop handling here if (config.display.auto_screen_carousel_secs > 0 && (millis() - lastScreenTransition) > (config.display.auto_screen_carousel_secs * 1000)) { + +// If an E-Ink display struggles with fast refresh, force carousel to use full refresh instead +// Carousel is potentially a major source of E-Ink display wear +#if !defined(EINK_BACKGROUND_USES_FAST) + EINK_ADD_FRAMEFLAG(dispdev, COSMETIC); +#endif + LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame\n", (millis() - lastScreenTransition)); handleOnPress(); } diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6fbbbf546..1f66857f8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -310,6 +310,10 @@ void NodeDB::installDefaultConfig() config.display.screen_on_secs = 30; config.display.wake_on_tap_or_motion = true; #endif +#ifdef HELTEC_VISION_MASTER_E290 + // Orient so that LoRa antenna faces up + config.display.flip_screen = true; +#endif initConfigIntervals(); } diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 8df5d2d9e..f4ee3abd2 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -17,6 +17,9 @@ #if !MESHTASTIC_EXCLUDE_GPS #include "GPS.h" #endif +#if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY) +#include "graphics/EInkDynamicDisplay.h" // To select between full and fast refresh on E-Ink displays +#endif #ifndef INPUTBROKER_MATRIX_TYPE #define INPUTBROKER_MATRIX_TYPE 0 @@ -928,6 +931,9 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->setFont(FONT_MEDIUM); display->drawString(display->getWidth() / 2 + x, 0 + y + 12, temporaryMessage); } else if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_ACK_NACK_RECEIVED) { + // E-Ink: clean the screen *after* this pop-up + EINK_ADD_FRAMEFLAG(display, COSMETIC); + requestFocus(); // Tell Screen::setFrames to move to our module's frame display->setTextAlignment(TEXT_ALIGN_CENTER); display->setFont(FONT_MEDIUM); @@ -950,6 +956,9 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->drawStringf(display->getWidth() / 2 + x, y + 130, buffer, rssiString, this->lastRxRssi); } } else if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE) { + // E-Ink: clean the screen *after* this pop-up + EINK_ADD_FRAMEFLAG(display, COSMETIC); + requestFocus(); // Tell Screen::setFrames to move to our module's frame display->setTextAlignment(TEXT_ALIGN_CENTER); display->setFont(FONT_MEDIUM); diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 3910f718f..6bce498ab 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -195,16 +195,16 @@ void cpuDeepSleep(uint32_t msecToWake) button(s), maybe we should not include any other GPIOs... */ #if SOC_RTCIO_HOLD_SUPPORTED - static const uint8_t rtcGpios[] = {/* 0, */ 2, - /* 4, */ -#ifndef USE_JTAG - 13, - /* 14, */ /* 15, */ + static const uint8_t rtcGpios[] = { +#ifndef HELTEC_VISION_MASTER_E213 + // For this variant, >20mA leaks through the display if pin 2 held + // Todo: check if it's safe to remove this pin for all variants + 2, #endif - /* 25, */ /* 26, */ /* 27, */ - /* 32, */ /* 33, */ 34, 35, - /* 36, */ 37 - /* 38, 39 */}; +#ifndef USE_JTAG + 13, +#endif + 34, 35, 37}; for (int i = 0; i < sizeof(rtcGpios); i++) rtc_gpio_isolate((gpio_num_t)rtcGpios[i]); diff --git a/variants/heltec_vision_master_e213/variant.h b/variants/heltec_vision_master_e213/variant.h index 99bc1d138..bbc697f09 100644 --- a/variants/heltec_vision_master_e213/variant.h +++ b/variants/heltec_vision_master_e213/variant.h @@ -15,9 +15,9 @@ // SPI #define SPI_INTERFACES_COUNT 2 -#define PIN_SPI_MISO 10 // MISO -#define PIN_SPI_MOSI 11 // MOSI -#define PIN_SPI_SCK 9 // SCK +#define PIN_SPI_MISO 11 +#define PIN_SPI_MOSI 10 +#define PIN_SPI_SCK 9 // Power #define VEXT_ENABLE 18 // Powers the E-Ink display, and the 3.3V supply to the I2C QuickLink connector @@ -29,11 +29,12 @@ #define ADC_CHANNEL ADC1_GPIO7_CHANNEL #define ADC_MULTIPLIER 4.9 * 1.03 #define ADC_ATTENUATION ADC_ATTEN_DB_2_5 +#define HAS_32768HZ // LoRa #define USE_SX1262 -#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_DIO0 RADIOLIB_NC // a No connect on the SX1262 module #define LORA_RESET 12 #define LORA_DIO1 14 // SX1262 IRQ #define LORA_DIO2 13 // SX1262 BUSY diff --git a/variants/heltec_vision_master_e290/pins_arduino.h b/variants/heltec_vision_master_e290/pins_arduino.h index e5d507846..77cf3176a 100644 --- a/variants/heltec_vision_master_e290/pins_arduino.h +++ b/variants/heltec_vision_master_e290/pins_arduino.h @@ -3,15 +3,15 @@ #include -static const uint8_t LED_BUILTIN = 35; +static const uint8_t LED_BUILTIN = -1; #define BUILTIN_LED LED_BUILTIN // backward compatibility #define LED_BUILTIN LED_BUILTIN static const uint8_t TX = 43; static const uint8_t RX = 44; -static const uint8_t SDA = 41; -static const uint8_t SCL = 42; +static const uint8_t SDA = 39; +static const uint8_t SCL = 38; static const uint8_t SS = 8; static const uint8_t MOSI = 10; @@ -56,6 +56,6 @@ static const uint8_t T14 = 14; static const uint8_t RST_LoRa = 12; static const uint8_t BUSY_LoRa = 13; -static const uint8_t DIO0 = 14; +static const uint8_t DIO1 = 14; #endif /* Pins_Arduino_h */ diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index 60ff60036..e1ba100ae 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -1,25 +1,25 @@ [env:heltec-vision-master-e290] -board_level = extra extends = esp32s3_base -board = heltec_wifi_lora_32_V3 +board = heltec_vision_master_e290 build_flags = ${esp32s3_base.build_flags} - -Ivariants/heltec_vision_master_e290 - -DHELTEC_VISION_MASTER_E290 - -DEINK_DISPLAY_MODEL=GxEPD2_290_BS - -DEINK_WIDTH=296 - -DEINK_HEIGHT=128 -; -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -; -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted -; -D EINK_LIMIT_RATE_BACKGROUND_SEC=1 ; Minimum interval between BACKGROUND updates -; -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -; -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated -; -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. -; -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" -; -D EINK_HASQUIRK_WEAKFASTREFRESH ; Pixels set with fast-refresh are easy to clear, disrupted by sunlight + -I variants/heltec_vision_master_e290 + -D HELTEC_VISION_MASTER_E290 + -D BUTTON_CLICK_MS=200 + -D EINK_DISPLAY_MODEL=GxEPD2_290_BN8 + -D EINK_WIDTH=296 + -D EINK_HEIGHT=128 + -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted + -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates + -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" + -D EINK_HASQUIRK_WEAKFASTREFRESH ; Pixels set with fast-refresh are easy to clear, disrupted by sunlight +; -D EINK_LIMIT_GHOSTING_PX=2000 ; How much image ghosting is tolerated +; -D EINK_BACKGROUND_USES_FAST ; (If enabled) don't redraw RESPONSIVE frames at next BACKGROUND update lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2#448c8538129fde3d02a7cb5e6fc81971ad92547f lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 \ No newline at end of file diff --git a/variants/heltec_vision_master_e290/variant.h b/variants/heltec_vision_master_e290/variant.h index a8ec5485b..6af4b06a5 100644 --- a/variants/heltec_vision_master_e290/variant.h +++ b/variants/heltec_vision_master_e290/variant.h @@ -1,48 +1,42 @@ -// #define LED_PIN 18 +#define BUTTON_PIN 0 -// Enable bus for external periherals +// I2C #define I2C_SDA SDA #define I2C_SCL SCL +// Display (E-Ink) #define USE_EINK - -/* - * eink display pins - */ #define PIN_EINK_CS 3 -#define PIN_EINK_BUSY 5 +#define PIN_EINK_BUSY 6 #define PIN_EINK_DC 4 #define PIN_EINK_RES 5 #define PIN_EINK_SCLK 2 #define PIN_EINK_MOSI 1 -/* - * SPI interfaces - */ +// SPI #define SPI_INTERFACES_COUNT 2 +#define PIN_SPI_MISO 11 +#define PIN_SPI_MOSI 10 +#define PIN_SPI_SCK 9 -#define PIN_SPI_MISO 10 // MISO -#define PIN_SPI_MOSI 11 // MOSI -#define PIN_SPI_SCK 9 // SCK - -#define VEXT_ENABLE 18 // powers the e-ink display -#define VEXT_ON_VALUE 1 -#define BUTTON_PIN 0 - +// Power +#define VEXT_ENABLE 18 // Powers the E-Ink display only +#define VEXT_ON_VALUE HIGH #define ADC_CTRL 46 #define ADC_CTRL_ENABLED HIGH #define BATTERY_PIN 7 #define ADC_CHANNEL ADC1_GPIO7_CHANNEL #define ADC_MULTIPLIER 4.9 * 1.03 -#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // Voltage divider output is quite high +#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 +#define HAS_32768HZ +// LoRa #define USE_SX1262 -#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_DIO0 RADIOLIB_NC // a No connect on the SX1262 module #define LORA_RESET 12 #define LORA_DIO1 14 // SX1262 IRQ #define LORA_DIO2 13 // SX1262 BUSY -#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled #define LORA_SCK 9 #define LORA_MISO 11 diff --git a/variants/heltec_wireless_paper/variant.h b/variants/heltec_wireless_paper/variant.h index c41d6d9df..a7bd460f7 100644 --- a/variants/heltec_wireless_paper/variant.h +++ b/variants/heltec_wireless_paper/variant.h @@ -16,9 +16,9 @@ // SPI #define SPI_INTERFACES_COUNT 2 -#define PIN_SPI_MISO 10 // MISO -#define PIN_SPI_MOSI 11 // MOSI -#define PIN_SPI_SCK 9 // SCK +#define PIN_SPI_MISO 11 +#define PIN_SPI_MOSI 10 +#define PIN_SPI_SCK 9 // Power #define VEXT_ENABLE 45 // Active low, powers the E-Ink display @@ -28,11 +28,12 @@ #define ADC_MULTIPLIER 2 // Voltage divider is roughly 1:1 #define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 #define ADC_ATTENUATION ADC_ATTEN_DB_12 // Voltage divider output is quite high +#define HAS_32768HZ // LoRa #define USE_SX1262 -#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_DIO0 RADIOLIB_NC // a No connect on the SX1262 module #define LORA_RESET 12 #define LORA_DIO1 14 // SX1262 IRQ #define LORA_DIO2 13 // SX1262 BUSY diff --git a/variants/heltec_wireless_paper_v1/variant.h b/variants/heltec_wireless_paper_v1/variant.h index c41d6d9df..a7bd460f7 100644 --- a/variants/heltec_wireless_paper_v1/variant.h +++ b/variants/heltec_wireless_paper_v1/variant.h @@ -16,9 +16,9 @@ // SPI #define SPI_INTERFACES_COUNT 2 -#define PIN_SPI_MISO 10 // MISO -#define PIN_SPI_MOSI 11 // MOSI -#define PIN_SPI_SCK 9 // SCK +#define PIN_SPI_MISO 11 +#define PIN_SPI_MOSI 10 +#define PIN_SPI_SCK 9 // Power #define VEXT_ENABLE 45 // Active low, powers the E-Ink display @@ -28,11 +28,12 @@ #define ADC_MULTIPLIER 2 // Voltage divider is roughly 1:1 #define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 #define ADC_ATTENUATION ADC_ATTEN_DB_12 // Voltage divider output is quite high +#define HAS_32768HZ // LoRa #define USE_SX1262 -#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_DIO0 RADIOLIB_NC // a No connect on the SX1262 module #define LORA_RESET 12 #define LORA_DIO1 14 // SX1262 IRQ #define LORA_DIO2 13 // SX1262 BUSY