Add three expansion screens for heltec mesh solar. (#7995)

* Add three expansion screens for heltec mesh solar.

* delete whitespace

Update variants/nrf52840/heltec_mesh_solar/variant.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* delete whitespace

Update variants/nrf52840/heltec_mesh_solar/platformio.ini

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Quency-D 2025-09-24 19:14:24 +08:00 committed by Ben Meadors
parent ca3c45a2f3
commit 949f881ae8
6 changed files with 202 additions and 12 deletions

View File

@ -243,7 +243,7 @@ bool EInkDisplay::connect()
adafruitDisplay->setRotation(1);
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
}
#elif defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK)
#elif defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK) || defined(HELTEC_MESH_SOLAR_EINK)
{
spi1 = &SPI1;
spi1->begin();

View File

@ -84,7 +84,7 @@ class EInkDisplay : public OLEDDisplay
SPIClass *hspi = NULL;
#endif
#if defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK)
#if defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK) || defined(HELTEC_MESH_SOLAR_EINK)
SPIClass *spi1 = NULL;
#endif

View File

@ -0,0 +1,90 @@
#pragma once
#include "configuration.h"
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
// InkHUD-specific components
// ---------------------------
#include "graphics/niche/InkHUD/InkHUD.h"
// Applets
#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h"
#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h"
#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h"
#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h"
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
// Shared NicheGraphics components
// --------------------------------
#include "graphics/niche/Drivers/EInk/E0213A367.h"
#include "graphics/niche/Inputs/TwoButton.h"
void setupNicheGraphics()
{
using namespace NicheGraphics;
// SPI
// -----------------------------
// For NRF52 platforms, SPI pins are defined in variant.h
SPI1.begin();
// E-Ink Driver
// -----------------------------
Drivers::EInk *driver = new Drivers::E0213A367;
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
// InkHUD
// ----------------------------
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
// Set the E-Ink driver
inkhud->setDriver(driver);
// Set how many FAST updates per FULL update
// Set how unhealthy additional FAST updates beyond this number are
inkhud->setDisplayResilience(10, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
inkhud->persistence->settings.optionalMenuItems.nextTile = true;
// Pick applets
// Note: order of applets determines priority of "auto-show" feature
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
// Start running InkHUD
inkhud->begin();
// Buttons
// --------------------------
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
// #0: Main User Button
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
// Begin handling button events
buttons->start();
}
#endif

View File

@ -1,5 +1,5 @@
; First prototype nrf52840/sx1262 device
[env:heltec-mesh-solar]
[heltec_mesh_solar_base]
extends = nrf52840_base
board = heltec_mesh_solar
board_level = pr
@ -17,3 +17,100 @@ lib_deps =
https://github.com/NMIoT/meshsolar/archive/dfc5330dad443982e6cdd37a61d33fc7252f468b.zip
lewisxhe/PCF8563_Library@^1.0.1
ArduinoJson@6.21.4
[env:heltec-mesh-solar]
extends = heltec_mesh_solar_base
build_flags = ${heltec_mesh_solar_base.build_flags}
-DSPI_INTERFACES_COUNT=1
[env:heltec-mesh-solar-eink]
extends = heltec_mesh_solar_base
build_flags = ${heltec_mesh_solar_base.build_flags}
-DHELTEC_MESH_SOLAR_EINK
-DSPI_INTERFACES_COUNT=2
-DUSE_EINK
-DPIN_SCREEN_VDD_CTL=3
-DPIN_EINK_CS=41
-DPIN_EINK_BUSY=11
-DPIN_EINK_DC=13
-DPIN_EINK_RES=40
-DPIN_EINK_SCLK=12
-DPIN_EINK_MOSI=2
-DPIN_SPI1_MISO=-1
-DPIN_SPI1_MOSI=PIN_EINK_MOSI
-DPIN_SPI1_SCK=PIN_EINK_SCLK
-DEINK_DISPLAY_MODEL=GxEPD2_213_E0213A367
-DEINK_WIDTH=250
-DEINK_HEIGHT=122
-DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk
-DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted
-DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates
-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
-DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
lib_deps =
${heltec_mesh_solar_base.lib_deps}
https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip
[env:heltec-mesh-solar-inkhud]
extends = heltec_mesh_solar_base, inkhud
build_src_filter = ${heltec_mesh_solar_base.build_src_filter} ${inkhud.build_src_filter}
build_flags = ${heltec_mesh_solar_base.build_flags}
${inkhud.build_flags}
-DHELTEC_MESH_SOLAR_INKHUD
-DSPI_INTERFACES_COUNT=2
-DPIN_SCREEN_VDD_CTL=3
-DPIN_EINK_CS=41
-DPIN_EINK_BUSY=11
-DPIN_EINK_DC=13
-DPIN_EINK_RES=40
-DPIN_EINK_SCLK=12
-DPIN_EINK_MOSI=2
-DPIN_SPI1_MISO=-1
-DPIN_SPI1_MOSI=PIN_EINK_MOSI
-DPIN_SPI1_SCK=PIN_EINK_SCLK
lib_deps =
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
${heltec_mesh_solar_base.lib_deps}
[env:heltec-mesh-solar-oled]
extends = heltec_mesh_solar_base
build_flags = ${heltec_mesh_solar_base.build_flags}
-DHELTEC_MESH_SOLAR_OLED
-DSPI_INTERFACES_COUNT=1
-DPIN_SCREEN_VDD_CTL=3
-DHAS_SCREEN=1
-DRESET_OLED=40
-DPIN_WIRE_SDA=2
-DPIN_WIRE_SCL=12
[env:heltec-mesh-solar-tft]
extends = heltec_mesh_solar_base
build_flags = ${heltec_mesh_solar_base.build_flags}
-DHELTEC_MESH_SOLAR_TFT
-DSPI_INTERFACES_COUNT=2
-DUSE_ST7789
-DST7789_NSS=41
-DST7789_RS=13
-DST7789_SDA=2
-DST7789_SCK=12
-DST7789_RESET=40
-DST7789_MISO=-1
-DST7789_BUSY=-1
-DVTFT_CTRL=3
-DVTFT_LEDA=11
-DTFT_BACKLIGHT_ON=HIGH
-DST7789_SPI_HOST=SPI2_HOST
-DSPI_FREQUENCY=10000000
-DSPI_READ_FREQUENCY=10000000
-DTFT_HEIGHT=170
-DTFT_WIDTH=320
-DTFT_OFFSET_X=0
-DTFT_OFFSET_Y=0
-DBRIGHTNESS_DEFAULT=100
-DPIN_SPI1_MISO=ST7789_MISO
-DPIN_SPI1_MOSI=ST7789_SDA
-DPIN_SPI1_SCK=ST7789_SCK
lib_deps =
${heltec_mesh_solar_base.lib_deps}
https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip

View File

@ -33,4 +33,9 @@ const uint32_t g_ADigitalPinMap[] = {
void initVariant()
{
pinMode(BQ4050_EMERGENCY_SHUTDOWN_PIN, INPUT);
#if defined(PIN_SCREEN_VDD_CTL)
pinMode(PIN_SCREEN_VDD_CTL, OUTPUT);
digitalWrite(PIN_SCREEN_VDD_CTL, LOW); // Start with power on
#endif
}

View File

@ -40,7 +40,7 @@ extern "C" {
#define NUM_ANALOG_OUTPUTS (0)
#define PIN_LED1 (0 + 12) // green (confirmed on 1.0 board)
#define PIN_LED1 (0 + 4) // green (confirmed on 1.0 board)
#define LED_BLUE PIN_LED1 // fake for bluefruit library
#define LED_GREEN PIN_LED1
#define LED_BUILTIN LED_GREEN
@ -63,7 +63,6 @@ No longer populated on PCB
*/
#define PIN_SERIAL2_RX (0 + 9)
#define PIN_SERIAL2_TX (0 + 10)
// #define PIN_SERIAL2_EN (0 + 17)
/*
* I2C
@ -71,16 +70,16 @@ No longer populated on PCB
#define WIRE_INTERFACES_COUNT 2
#ifndef HELTEC_MESH_SOLAR_OLED
// I2C bus 0
// Routed to footprint for PCF8563TS RTC
// Not populated on T114 V1, maybe in future?
#define PIN_WIRE_SDA (0 + 6) // P0.26
#define PIN_WIRE_SCL (0 + 26) // P0.26
#define PIN_WIRE_SDA (0 + 6)
#define PIN_WIRE_SCL (0 + 26)
#endif
// I2C bus 1
// Available on header pins, for general use
#define PIN_WIRE1_SDA (0 + 30) // P0.30
#define PIN_WIRE1_SCL (0 + 5) // P0.13
#define PIN_WIRE1_SDA (0 + 30)
#define PIN_WIRE1_SCL (0 + 5)
/*
* Lora radio
@ -129,7 +128,6 @@ No longer populated on PCB
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
// For LORA, spi 0
#define PIN_SPI_MISO (0 + 23)