T5-4.7-S3 Epaper Pro support (#6625)
* preliminary io pin definitions * Update product link * Move to new variant structure and refactor inkHUD - Display does not work and SX1262 init fails on HT752-02 * update variant definitions * add EPD driver * fix lora, add v1/v2 variant targets * adapt pins for v1/v2 * alt button * add compile guards * use lilygo epd47 lib * workaround for INT ERR_NOT_FOUND * USE_EPD (e-ink parallel display) * use FastEPD driver * create screen * EInkParallelDisplay definition * setup screen * dispaly() implementation * enable touchscreen * rotate touch screen * refactor display buffer processing * provide local copy of TwoWire instance as the touch driver calls end() * use larger fonts * replace touch driver; enable debugging * replace touch driver; enable debugging * consider bitsremain == 0 * tryfix crash * fix button * update touch driver * set lora_cs pin * update touch driver and lib reference * add locks * limit Ghosting similar to EInkDynamicDisplay * workaround for FastEPD partial update bug (artifacts) * display() code cleanup * fix a few platformio definitions * more EPD display cleanup * set rotation * use FastEPD arduino I2C by default * touch rotation * update screen for EPD * increase swipe distance for larger screen * EPD UIRenderer * trunk fmt * further #ifdef USE_EPD * disable rotation which messes up w/h; more cleanup * switch off ghosting algo * releease build; V1 buttons * swap V1 buttons * rearrange USE_EINK/EPD macros, use large font * cleanup (revert modified files) * more cleanup * revert * revert file * revert file Removed redundant line continuation in preprocessor directives. * Temporary gate off PSRam calculations until we can fix them * move variant.cpp and update commit references * revert wrong merge * add earlyInitVariant() * initialize all port 0 pins (0-7) as outputs / HIGH --------- Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com> Co-authored-by: Jason P <applewiz@mac.com> Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
GitHub
Thomas Göttgens
Jason P
Jonathan Bennett
Ben Meadors
parent
d693fd4232
commit
3b079c91bf
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
|
||||
Most of the Meshtastic firmware uses preprocessor macros throughout the code to support different hardware variants.
|
||||
NicheGraphics attempts a different approach:
|
||||
|
||||
Per-device config takes place in this setupNicheGraphics() method
|
||||
(And a small amount in platformio.ini)
|
||||
|
||||
This file sets up InkHUD for Heltec VM-E290.
|
||||
Different NicheGraphics UIs and different hardware variants will each have their own setup procedure.
|
||||
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "configuration.h"
|
||||
#include "mesh/MeshModule.h"
|
||||
|
||||
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||
|
||||
// InkHUD-specific components
|
||||
// ---------------------------
|
||||
// #include "graphics/niche/InkHUD/InkHUD.h"
|
||||
#include "graphics/niche/InkHUD/WindowManager.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/Backlight/LatchingBacklight.h"
|
||||
#include "graphics/niche/Drivers/EInk/DEPG0290BNS800.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
|
||||
// SPI
|
||||
// -----------------------------
|
||||
|
||||
// Display is connected to HSPI
|
||||
SPIClass *hspi = new SPIClass(HSPI);
|
||||
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS);
|
||||
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::DEPG0290BNS800;
|
||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY);
|
||||
|
||||
// InkHUD
|
||||
// ----------------------------
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(7, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Init settings, and customize defaults
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
inkhud->persistence->settings.rotation = 1; // 90 degrees clockwise
|
||||
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead
|
||||
inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery
|
||||
|
||||
// Setup backlight
|
||||
// Note: AUX button behavior configured further down
|
||||
Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance();
|
||||
backlight->setPin(PIN_EINK_EN);
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
// Optional arguments for defaults:
|
||||
// - is activated?
|
||||
// - is autoshown?
|
||||
// - is foreground on a specific tile (index)?
|
||||
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, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
|
||||
// Buttons
|
||||
// --------------------------
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // A shared NicheGraphics component
|
||||
|
||||
// Setup the main user button (0)
|
||||
buttons->setWiring(0, BUTTON_PIN);
|
||||
buttons->setHandlerShortPress(0, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
|
||||
// Setup the aux button (1)
|
||||
// Bonus feature of VME290
|
||||
buttons->setWiring(1, BUTTON_PIN_SECONDARY);
|
||||
buttons->setHandlerShortPress(1, []() { InkHUD::InkHUD::getInstance()->nextTile(); });
|
||||
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define USB_VID 0x303a
|
||||
#define USB_PID 0x1001
|
||||
|
||||
#if defined(T5_S3_EPAPER_PRO_V1)
|
||||
// The default Wire will be mapped to RTC, Touch, BQ25896, and BQ27220
|
||||
static const uint8_t SDA = 6;
|
||||
static const uint8_t SCL = 5;
|
||||
|
||||
// Default SPI will be mapped to Radio
|
||||
static const uint8_t SS = 46;
|
||||
static const uint8_t MOSI = 17;
|
||||
static const uint8_t MISO = 8;
|
||||
static const uint8_t SCK = 18;
|
||||
|
||||
#define SPI_MOSI (17)
|
||||
#define SPI_SCK (18)
|
||||
#define SPI_MISO (8)
|
||||
#define SPI_CS (16)
|
||||
|
||||
#else // T5_S3_EPAPER_PRO_V2
|
||||
// The default Wire will be mapped to RTC, Touch, PCA9535, BQ25896, and BQ27220
|
||||
static const uint8_t SDA = 39;
|
||||
static const uint8_t SCL = 40;
|
||||
|
||||
// Default SPI will be mapped to Radio
|
||||
static const uint8_t SS = 46;
|
||||
static const uint8_t MOSI = 13;
|
||||
static const uint8_t MISO = 21;
|
||||
static const uint8_t SCK = 14;
|
||||
|
||||
#define SPI_MOSI (13)
|
||||
#define SPI_SCK (14)
|
||||
#define SPI_MISO (21)
|
||||
#define SPI_CS (12)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
@@ -0,0 +1,61 @@
|
||||
[t5s3_epaper_base]
|
||||
extends = esp32s3_base
|
||||
board = t5-epaper-s3
|
||||
board_build.partition = default_16MB.csv
|
||||
board_check = true
|
||||
upload_protocol = esptool
|
||||
build_flags = -fno-strict-aliasing
|
||||
${esp32_base.build_flags}
|
||||
-I variants/esp32s3/t5s3_epaper
|
||||
-D T5_S3_EPAPER_PRO
|
||||
-D USE_EINK
|
||||
-D USE_EINK_PARALLELDISPLAY
|
||||
-D PRIVATE_HW
|
||||
-D TOUCH_THRESHOLD_X=60
|
||||
-D TOUCH_THRESHOLD_Y=40
|
||||
-D TIME_LONG_PRESS=500
|
||||
; -D EINK_LIMIT_GHOSTING_PX=5000
|
||||
-D EPD_FULLSLOW_PERIOD=100
|
||||
-D FAST_EPD_PARTIAL_UPDATE_BUG ; use rect area update instead of partial
|
||||
|
||||
build_src_filter =
|
||||
${esp32s3_base.build_src_filter}
|
||||
+<../variants/esp32s3/t5s3_epaper>
|
||||
lib_deps =
|
||||
${esp32s3_base.lib_deps}
|
||||
# renovate: datasource=github-tags depName=XPowersLib packageName=lewisxhe/XPowersLib
|
||||
https://github.com/lewisxhe/XPowersLib/archive/refs/tags/v0.3.3.zip
|
||||
# renovate: datasource=github-tags depName=SensorLib packageName=lewisxhe/SensorLib
|
||||
https://github.com/lewisxhe/SensorLib/archive/refs/tags/v0.3.4.zip
|
||||
https://github.com/mverch67/BQ27220/archive/07d92be846abd8a0258a50c23198dac0858b22ed.zip
|
||||
https://github.com/mverch67/FastEPD/archive/0df1bff329b6fc782e062f611758880762340647.zip
|
||||
|
||||
[env:t5s3_epaper_inkhud]
|
||||
extends = t5s3_epaper_base, inkhud
|
||||
build_flags =
|
||||
${t5s3_epaper_base.build_flags}
|
||||
${inkhud.build_flags}
|
||||
-D SDCARD_USE_SPI1
|
||||
-D T5_S3_EPAPER_PRO_V2
|
||||
build_src_filter =
|
||||
${t5s3_epaper_base.build_src_filter}
|
||||
${inkhud.build_src_filter}
|
||||
lib_deps =
|
||||
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
|
||||
${t5s3_epaper_base.lib_deps}
|
||||
|
||||
|
||||
[env:t5s3-epaper-v1] ; H752
|
||||
extends = t5s3_epaper_base
|
||||
build_flags =
|
||||
${t5s3_epaper_base.build_flags}
|
||||
-D T5_S3_EPAPER_PRO_V1
|
||||
-D GPS_DEFAULT_NOT_PRESENT=1
|
||||
|
||||
[env:t5s3-epaper-v2] ; H752-01
|
||||
extends = t5s3_epaper_base
|
||||
build_flags =
|
||||
${t5s3_epaper_base.build_flags}
|
||||
-D T5_S3_EPAPER_PRO_V2
|
||||
-D SDCARD_USE_SPI1
|
||||
-D GPS_POWER_TOGGLE
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "configuration.h"
|
||||
|
||||
#ifdef T5_S3_EPAPER_PRO
|
||||
|
||||
#include "TouchDrvGT911.hpp"
|
||||
#include "Wire.h"
|
||||
#include "input/TouchScreenImpl1.h"
|
||||
|
||||
TouchDrvGT911 touch;
|
||||
|
||||
bool readTouch(int16_t *x, int16_t *y)
|
||||
{
|
||||
if (!digitalRead(GT911_PIN_INT)) {
|
||||
int16_t raw_x;
|
||||
int16_t raw_y;
|
||||
if (touch.getPoint(&raw_x, &raw_y)) {
|
||||
// rotate 90° for landscape
|
||||
*x = raw_y;
|
||||
*y = EPD_WIDTH - 1 - raw_x;
|
||||
LOG_DEBUG("touched(%d/%d)", *x, *y);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void earlyInitVariant()
|
||||
{
|
||||
pinMode(LORA_CS, OUTPUT);
|
||||
digitalWrite(LORA_CS, HIGH);
|
||||
pinMode(SDCARD_CS, OUTPUT);
|
||||
digitalWrite(SDCARD_CS, HIGH);
|
||||
pinMode(BOARD_BL_EN, OUTPUT);
|
||||
}
|
||||
|
||||
// T5-S3-ePaper Pro specific (late-) init
|
||||
void lateInitVariant(void)
|
||||
{
|
||||
touch.setPins(GT911_PIN_RST, GT911_PIN_INT);
|
||||
if (touch.begin(Wire, GT911_SLAVE_ADDRESS_L, GT911_PIN_SDA, GT911_PIN_SCL)) {
|
||||
touchScreenImpl1 = new TouchScreenImpl1(EPD_WIDTH, EPD_HEIGHT, readTouch);
|
||||
touchScreenImpl1->init();
|
||||
} else {
|
||||
LOG_ERROR("Failed to find touch controller!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
// Display (E-Ink) ED047TC1 - 8bit parallel
|
||||
#define EPD_WIDTH 960
|
||||
#define EPD_HEIGHT 540
|
||||
|
||||
#define CANNED_MESSAGE_MODULE_ENABLE 1
|
||||
#define USE_VIRTUAL_KEYBOARD 1
|
||||
|
||||
#if defined(T5_S3_EPAPER_PRO_V1)
|
||||
#define BOARD_BL_EN 40
|
||||
#else
|
||||
#define BOARD_BL_EN 11
|
||||
#endif
|
||||
|
||||
#define I2C_SDA SDA
|
||||
#define I2C_SCL SCL
|
||||
|
||||
#define HAS_TOUCHSCREEN 1
|
||||
#define GT911_PIN_SDA SDA
|
||||
#define GT911_PIN_SCL SCL
|
||||
#if defined(T5_S3_EPAPER_PRO_V1)
|
||||
#define GT911_PIN_INT 15
|
||||
#define GT911_PIN_RST 41
|
||||
#else
|
||||
#define GT911_PIN_INT 3
|
||||
#define GT911_PIN_RST 9
|
||||
#endif
|
||||
|
||||
#define PCF85063_RTC 0x51
|
||||
#define HAS_RTC 1
|
||||
#define PCF85063_INT 2
|
||||
|
||||
#define USE_POWERSAVE
|
||||
#define SLEEP_TIME 120
|
||||
|
||||
// GPS
|
||||
#if !defined(T5_S3_EPAPER_PRO_V1)
|
||||
#define GPS_RX_PIN 44
|
||||
#define GPS_TX_PIN 43
|
||||
#endif
|
||||
|
||||
#if defined(T5_S3_EPAPER_PRO_V1)
|
||||
#define BUTTON_PIN 48
|
||||
#define PIN_BUTTON2 0
|
||||
#define ALT_BUTTON_PIN PIN_BUTTON2
|
||||
#else
|
||||
#define BUTTON_PIN 0
|
||||
#endif
|
||||
|
||||
// SD card
|
||||
#define HAS_SDCARD
|
||||
#define SDCARD_CS SPI_CS
|
||||
#define SD_SPI_FREQUENCY 75000000U
|
||||
|
||||
// battery charger BQ25896
|
||||
#define HAS_PPM 1
|
||||
#define XPOWERS_CHIP_BQ25896
|
||||
|
||||
// battery quality management BQ27220
|
||||
#define HAS_BQ27220 1
|
||||
#define BQ27220_I2C_SDA SDA
|
||||
#define BQ27220_I2C_SCL SCL
|
||||
#define BQ27220_DESIGN_CAPACITY 1500
|
||||
|
||||
// LoRa
|
||||
#define USE_SX1262
|
||||
#define USE_SX1268
|
||||
|
||||
#define LORA_SCK SCK
|
||||
#define LORA_MISO MISO
|
||||
#define LORA_MOSI MOSI
|
||||
#define LORA_CS 46
|
||||
|
||||
#define LORA_DIO0 -1
|
||||
#if defined(T5_S3_EPAPER_PRO_V1)
|
||||
#define LORA_RESET 43
|
||||
#define LORA_DIO1 3 // SX1262 IRQ
|
||||
#define LORA_DIO2 44 // SX1262 BUSY
|
||||
#define LORA_DIO3
|
||||
#else
|
||||
#define LORA_RESET 1
|
||||
#define LORA_DIO1 10 // SX1262 IRQ
|
||||
#define LORA_DIO2 47 // SX1262 BUSY
|
||||
#define LORA_DIO3
|
||||
#endif
|
||||
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY LORA_DIO2
|
||||
#define SX126X_RESET LORA_RESET
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 2.4
|
||||
Reference in New Issue
Block a user