T-mini Eink S3 Support for both InkHUD and BaseUI (#9856)
* Tmini Eink fix * tuning * better refresh * Fix to lora pins to be like the original. * Update pins_arduino.h * removed dead flags from previous tests * Update src/graphics/niche/Drivers/EInk/GDEW0102T4.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
Ben Meadors
co-authored by
Ben Meadors
Copilot
parent
e282491cd8
commit
286bc852b3
@@ -0,0 +1,131 @@
|
||||
#pragma once
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||
|
||||
// InkHUD-specific components
|
||||
#include "graphics/niche/InkHUD/InkHUD.h"
|
||||
|
||||
// Applets
|
||||
#include "graphics/niche/InkHUD/Applet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/FavoritesMap/FavoritesMapApplet.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"
|
||||
#include "graphics/niche/InkHUD/SystemApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
#include "graphics/niche/Drivers/EInk/GDEW0102T4.h"
|
||||
#include "graphics/niche/Inputs/TwoButtonExtended.h"
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
|
||||
// Power-enable the E-Ink panel on this board before any SPI traffic.
|
||||
pinMode(PIN_EINK_EN, OUTPUT);
|
||||
digitalWrite(PIN_EINK_EN, HIGH);
|
||||
delay(10);
|
||||
|
||||
// Display uses HSPI on this board
|
||||
SPIClass *hspi = new SPIClass(HSPI);
|
||||
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS);
|
||||
|
||||
Drivers::GDEW0102T4 *displayDriver = new Drivers::GDEW0102T4;
|
||||
displayDriver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
// Tuned fast-refresh values reg30 reg50 reg82 lutW2 lutB2 = 11 F2 04 11 0D
|
||||
displayDriver->setFastConfig({0x11, 0xF2, 0x04, 0x11, 0x0D});
|
||||
Drivers::EInk *driver = displayDriver;
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
inkhud->setDriver(driver);
|
||||
// Slightly stricter FAST/FULL
|
||||
inkhud->setDisplayResilience(5, 1.5);
|
||||
inkhud->twoWayRocker = true;
|
||||
|
||||
// Fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontMedium = FREESANS_6PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Small display defaults
|
||||
inkhud->persistence->settings.rotation = 0;
|
||||
inkhud->persistence->settings.userTiles.maxCount = 1;
|
||||
inkhud->persistence->settings.userTiles.count = 1;
|
||||
inkhud->persistence->settings.joystick.enabled = true;
|
||||
inkhud->persistence->settings.joystick.aligned = true;
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = false;
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, false, false); // -
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet, true, false); // Activated, not autoshown
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0), true, true); // Activated, Autoshown
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1), false, false); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Favorites Map", new InkHUD::FavoritesMapApplet, false, false); // -
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet, false, false); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
|
||||
// Enforce two-way rocker behavior regardless of persisted settings.
|
||||
inkhud->persistence->settings.joystick.enabled = true;
|
||||
inkhud->persistence->settings.joystick.aligned = true;
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = false;
|
||||
|
||||
// Inputs
|
||||
Inputs::TwoButtonExtended *buttons = Inputs::TwoButtonExtended::getInstance();
|
||||
|
||||
// Center press (boot button)
|
||||
buttons->setWiring(0, INPUTDRIVER_TWO_WAY_ROCKER_BTN, true);
|
||||
// Match baseUI encoder long-press feel.
|
||||
buttons->setTiming(0, 75, 300);
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// LEFT rocker pin is IO4; RIGHT rocker pin is IO3.
|
||||
buttons->setTwoWayRockerWiring(INPUTDRIVER_TWO_WAY_ROCKER_LEFT, INPUTDRIVER_TWO_WAY_ROCKER_RIGHT, true);
|
||||
buttons->setJoystickDebounce(50);
|
||||
|
||||
// Two-way rocker behavior:
|
||||
// - when a system applet is handling input (menu, tips, etc): LEFT=up, RIGHT=down
|
||||
// - otherwise: LEFT=previous applet, RIGHT=next applet
|
||||
buttons->setTwoWayRockerPressHandlers(
|
||||
[inkhud]() {
|
||||
bool systemHandlingInput = false;
|
||||
for (InkHUD::SystemApplet *sa : inkhud->systemApplets) {
|
||||
if (sa->handleInput) {
|
||||
systemHandlingInput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemHandlingInput)
|
||||
inkhud->navUp();
|
||||
else
|
||||
inkhud->prevApplet();
|
||||
},
|
||||
[inkhud]() {
|
||||
bool systemHandlingInput = false;
|
||||
for (InkHUD::SystemApplet *sa : inkhud->systemApplets) {
|
||||
if (sa->handleInput) {
|
||||
systemHandlingInput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemHandlingInput)
|
||||
inkhud->navDown();
|
||||
else
|
||||
inkhud->nextApplet();
|
||||
});
|
||||
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,24 +3,23 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define USB_VID 0x303a
|
||||
#define USB_VID 0x303A
|
||||
#define USB_PID 0x1001
|
||||
|
||||
// The default Wire will be mapped to PMU and RTC
|
||||
static const uint8_t SDA = 18;
|
||||
static const uint8_t SCL = 9;
|
||||
|
||||
// Default SPI will be mapped to Radio
|
||||
// Default SPI (LoRa bus)
|
||||
static const uint8_t SS = -1;
|
||||
static const uint8_t MOSI = 17;
|
||||
static const uint8_t MISO = 6;
|
||||
static const uint8_t SCK = 8;
|
||||
|
||||
// SD card SPI bus
|
||||
#define SPI_MOSI (39)
|
||||
#define SPI_SCK (41)
|
||||
#define SPI_MISO (38)
|
||||
#define SPI_CS (40)
|
||||
|
||||
#define SDCARD_CS SPI_CS
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
||||
@@ -17,11 +17,15 @@ upload_protocol = esptool
|
||||
build_flags =
|
||||
${esp32s3_base.build_flags}
|
||||
-I variants/esp32s3/mini-epaper-s3
|
||||
-DMINI_EPAPER_S3
|
||||
-DUSE_EINK
|
||||
-DEINK_DISPLAY_MODEL=GxEPD2_102
|
||||
-DEINK_WIDTH=128
|
||||
-DEINK_HEIGHT=80
|
||||
-D MINI_EPAPER_S3
|
||||
-D USE_EINK
|
||||
-D EINK_DISPLAY_MODEL=GxEPD2_102
|
||||
-D EINK_WIDTH=128
|
||||
-D EINK_HEIGHT=80
|
||||
-D USE_EINK_DYNAMICDISPLAY
|
||||
-D EINK_LIMIT_FASTREFRESH=3
|
||||
-D EINK_BACKGROUND_USES_FAST
|
||||
-D EINK_HASQUIRK_GHOSTING
|
||||
|
||||
lib_deps =
|
||||
${esp32s3_base.lib_deps}
|
||||
@@ -29,3 +33,22 @@ lib_deps =
|
||||
https://github.com/meshtastic/GxEPD2/archive/c7eb4c3c167cf396ef4f541cc5d4c6aa42f3c46b.zip
|
||||
# renovate: datasource=custom.pio depName=SensorLib packageName=lewisxhe/library/SensorLib
|
||||
lewisxhe/SensorLib@0.3.4
|
||||
|
||||
[env:mini-epaper-s3-inkhud]
|
||||
extends = esp32s3_base, inkhud
|
||||
board = mini-epaper-s3
|
||||
board_check = true
|
||||
upload_protocol = esptool
|
||||
build_src_filter =
|
||||
${esp32s3_base.build_src_filter}
|
||||
${inkhud.build_src_filter}
|
||||
build_flags =
|
||||
${esp32s3_base.build_flags}
|
||||
${inkhud.build_flags}
|
||||
-I variants/esp32s3/mini-epaper-s3
|
||||
-D MINI_EPAPER_S3
|
||||
lib_deps =
|
||||
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
|
||||
${esp32s3_base.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=SensorLib packageName=lewisxhe/library/SensorLib
|
||||
lewisxhe/SensorLib@0.3.4
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
// Display (E-Ink)
|
||||
#pragma once
|
||||
|
||||
#define PIN_EINK_CS 13
|
||||
#define PIN_EINK_BUSY 10
|
||||
#define PIN_EINK_RES 11
|
||||
#define PIN_EINK_SCLK 14
|
||||
#define PIN_EINK_MOSI 15
|
||||
#define PIN_EINK_DC 12
|
||||
#define PIN_EINK_EN 42
|
||||
#define GPS_DEFAULT_NOT_PRESENT 1
|
||||
|
||||
#define SPI_INTERFACES_COUNT 2
|
||||
#define PIN_SPI1_MISO -1
|
||||
#define PIN_SPI1_MOSI PIN_EINK_MOSI
|
||||
#define PIN_SPI1_SCK PIN_EINK_SCLK
|
||||
#define DISPLAY_FORCE_SMALL_FONTS
|
||||
// SD card (TF)
|
||||
#define HAS_SDCARD
|
||||
#define SDCARD_USE_SPI1
|
||||
#define SDCARD_CS 40
|
||||
#define SD_SPI_FREQUENCY 25000000U
|
||||
|
||||
// Built-in RTC (I2C)
|
||||
#define PCF8563_RTC 0x51
|
||||
#define HAS_RTC 1
|
||||
#define I2C_SDA SDA
|
||||
#define I2C_SCL SCL
|
||||
|
||||
// Battery voltage monitoring
|
||||
#define BATTERY_PIN 2 // A battery voltage measurement pin, voltage divider connected here to
|
||||
// measure battery voltage ratio of voltage divider = 2.0 (assumption)
|
||||
#define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage.
|
||||
#define ADC_CHANNEL ADC1_GPIO2_CHANNEL
|
||||
|
||||
#define HAS_GPS 0
|
||||
#undef GPS_RX_PIN
|
||||
#undef GPS_TX_PIN
|
||||
// Display (E-Ink)
|
||||
#define PIN_EINK_EN 42
|
||||
#define PIN_EINK_CS 13
|
||||
#define PIN_EINK_BUSY 10
|
||||
#define PIN_EINK_DC 12
|
||||
#define PIN_EINK_RES 11
|
||||
#define PIN_EINK_SCLK 14
|
||||
#define PIN_EINK_MOSI 15
|
||||
#define DISPLAY_FORCE_SMALL_FONTS
|
||||
|
||||
#define BUTTON_PIN 3
|
||||
#define BUTTON_NEED_PULLUP
|
||||
#define ALT_BUTTON_PIN 4
|
||||
#define ALT_BUTTON_ACTIVE_LOW true
|
||||
#define ALT_BUTTON_ACTIVE_PULLUP true
|
||||
#define PIN_BUTTON3 0
|
||||
|
||||
// #define HAS_SDCARD 1
|
||||
// #define SDCARD_USE_SOFT_SPI
|
||||
|
||||
// PCF85063 RTC Module
|
||||
#define PCF85063_RTC 0x51
|
||||
#define HAS_RTC 1
|
||||
// Two-Way Rocker input (left/right + boot as press)
|
||||
#define INPUTDRIVER_TWO_WAY_ROCKER
|
||||
#define INPUTDRIVER_ENCODER_TYPE 2
|
||||
#define INPUTDRIVER_TWO_WAY_ROCKER_RIGHT 3
|
||||
#define INPUTDRIVER_TWO_WAY_ROCKER_LEFT 4
|
||||
#define INPUTDRIVER_TWO_WAY_ROCKER_BTN 0
|
||||
#define UPDOWN_LONG_PRESS_REPEAT_INTERVAL 150
|
||||
|
||||
// LoRa (SX1262)
|
||||
#define USE_SX1262
|
||||
|
||||
#define LORA_DIO1 5
|
||||
#define LORA_SCK 8
|
||||
#define LORA_MISO 6
|
||||
|
||||
Reference in New Issue
Block a user