Skip to content

Commit

Permalink
Merge branch 'master' into pr-genuf2
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern authored Aug 2, 2024
2 parents f970c46 + 4b4c166 commit 1c77f7f
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 61 deletions.
42 changes: 42 additions & 0 deletions boards/heltec_vision_master_e290.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions src/graphics/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
9 changes: 9 additions & 0 deletions src/modules/CannedMessageModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions src/platform/esp32/main-esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, */
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
#ifndef USE_JTAG
13,
/* 14, */ /* 15, */
13,
#endif
/* 25, */ /* 26, */ /* 27, */
/* 32, */ /* 33, */ 34, 35,
/* 36, */ 37
/* 38, 39 */};
34, 35, 37};

for (int i = 0; i < sizeof(rtcGpios); i++)
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
Expand Down
9 changes: 5 additions & 4 deletions variants/heltec_vision_master_e213/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions variants/heltec_vision_master_e290/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

#include <stdint.h>

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;
Expand Down Expand Up @@ -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 */
32 changes: 16 additions & 16 deletions variants/heltec_vision_master_e290/platformio.ini
Original file line number Diff line number Diff line change
@@ -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
36 changes: 15 additions & 21 deletions variants/heltec_vision_master_e290/variant.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions variants/heltec_wireless_paper/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions variants/heltec_wireless_paper_v1/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1c77f7f

Please sign in to comment.