mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-08 19:07:26 +00:00
Compare commits
7 Commits
t5-epaper-
...
t-echo-plu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0601537fe1 | ||
|
|
d71305306c | ||
|
|
2ed82874b0 | ||
|
|
36a9adbe3a | ||
|
|
99e76483f5 | ||
|
|
e0f6ea2ed0 | ||
|
|
8b0eb98f04 |
@@ -148,7 +148,7 @@ bool EInkDisplay::connect()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) || defined(T_ECHO_LITE)
|
#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) || defined(T_ECHO_LITE) || defined(TTGO_T_ECHO_PLUS)
|
||||||
{
|
{
|
||||||
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ bool ButtonThread::initButton(const ButtonConfig &config)
|
|||||||
_activeLow = config.activeLow;
|
_activeLow = config.activeLow;
|
||||||
_touchQuirk = config.touchQuirk;
|
_touchQuirk = config.touchQuirk;
|
||||||
_intRoutine = config.intRoutine;
|
_intRoutine = config.intRoutine;
|
||||||
|
_pressHandler = config.onPress;
|
||||||
|
_releaseHandler = config.onRelease;
|
||||||
|
_suppressLeadUp = config.suppressLeadUpSound;
|
||||||
_longLongPress = config.longLongPress;
|
_longLongPress = config.longLongPress;
|
||||||
|
|
||||||
userButton = OneButton(config.pinNumber, config.activeLow, config.activePullup);
|
userButton = OneButton(config.pinNumber, config.activeLow, config.activePullup);
|
||||||
@@ -133,6 +136,8 @@ int32_t ButtonThread::runOnce()
|
|||||||
|
|
||||||
// Detect start of button press
|
// Detect start of button press
|
||||||
if (buttonCurrentlyPressed && !buttonWasPressed) {
|
if (buttonCurrentlyPressed && !buttonWasPressed) {
|
||||||
|
if (_pressHandler)
|
||||||
|
_pressHandler();
|
||||||
buttonPressStartTime = millis();
|
buttonPressStartTime = millis();
|
||||||
leadUpPlayed = false;
|
leadUpPlayed = false;
|
||||||
leadUpSequenceActive = false;
|
leadUpSequenceActive = false;
|
||||||
@@ -140,7 +145,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Progressive lead-up sound system
|
// Progressive lead-up sound system
|
||||||
if (buttonCurrentlyPressed && (millis() - buttonPressStartTime) >= BUTTON_LEADUP_MS) {
|
if (!_suppressLeadUp && buttonCurrentlyPressed && (millis() - buttonPressStartTime) >= BUTTON_LEADUP_MS) {
|
||||||
|
|
||||||
// Start the progressive sequence if not already active
|
// Start the progressive sequence if not already active
|
||||||
if (!leadUpSequenceActive) {
|
if (!leadUpSequenceActive) {
|
||||||
@@ -160,6 +165,8 @@ int32_t ButtonThread::runOnce()
|
|||||||
|
|
||||||
// Reset when button is released
|
// Reset when button is released
|
||||||
if (!buttonCurrentlyPressed && buttonWasPressed) {
|
if (!buttonCurrentlyPressed && buttonWasPressed) {
|
||||||
|
if (_releaseHandler)
|
||||||
|
_releaseHandler();
|
||||||
leadUpSequenceActive = false;
|
leadUpSequenceActive = false;
|
||||||
resetLeadUpSequence();
|
resetLeadUpSequence();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ struct ButtonConfig {
|
|||||||
bool activePullup = true;
|
bool activePullup = true;
|
||||||
uint32_t pullupSense = 0;
|
uint32_t pullupSense = 0;
|
||||||
voidFuncPtr intRoutine = nullptr;
|
voidFuncPtr intRoutine = nullptr;
|
||||||
|
voidFuncPtr onPress = nullptr; // Optional edge callbacks
|
||||||
|
voidFuncPtr onRelease = nullptr; // Optional edge callbacks
|
||||||
|
bool suppressLeadUpSound = false;
|
||||||
input_broker_event singlePress = INPUT_BROKER_NONE;
|
input_broker_event singlePress = INPUT_BROKER_NONE;
|
||||||
input_broker_event longPress = INPUT_BROKER_NONE;
|
input_broker_event longPress = INPUT_BROKER_NONE;
|
||||||
uint16_t longPressTime = 500;
|
uint16_t longPressTime = 500;
|
||||||
@@ -94,6 +97,9 @@ class ButtonThread : public Observable<const InputEvent *>, public concurrency::
|
|||||||
input_broker_event _shortLong = INPUT_BROKER_NONE;
|
input_broker_event _shortLong = INPUT_BROKER_NONE;
|
||||||
|
|
||||||
voidFuncPtr _intRoutine = nullptr;
|
voidFuncPtr _intRoutine = nullptr;
|
||||||
|
voidFuncPtr _pressHandler = nullptr;
|
||||||
|
voidFuncPtr _releaseHandler = nullptr;
|
||||||
|
bool _suppressLeadUp = false;
|
||||||
uint16_t _longPressTime = 500;
|
uint16_t _longPressTime = 500;
|
||||||
uint16_t _longLongPressTime = 3900;
|
uint16_t _longLongPressTime = 3900;
|
||||||
int _pinNum = 0;
|
int _pinNum = 0;
|
||||||
|
|||||||
32
src/main.cpp
32
src/main.cpp
@@ -107,6 +107,10 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr;
|
|||||||
|
|
||||||
#if defined(BUTTON_PIN_TOUCH)
|
#if defined(BUTTON_PIN_TOUCH)
|
||||||
ButtonThread *TouchButtonThread = nullptr;
|
ButtonThread *TouchButtonThread = nullptr;
|
||||||
|
#if defined(TTGO_T_ECHO_PLUS) && defined(PIN_EINK_EN)
|
||||||
|
static bool touchBacklightWasOn = false;
|
||||||
|
static bool touchBacklightActive = false;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO)
|
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO)
|
||||||
@@ -205,7 +209,7 @@ ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE,
|
|||||||
/// The I2C address of our Air Quality Indicator (if found)
|
/// The I2C address of our Air Quality Indicator (if found)
|
||||||
ScanI2C::DeviceAddress aqi_found = ScanI2C::ADDRESS_NONE;
|
ScanI2C::DeviceAddress aqi_found = ScanI2C::ADDRESS_NONE;
|
||||||
|
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
Adafruit_DRV2605 drv;
|
Adafruit_DRV2605 drv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -788,7 +792,6 @@ void setup()
|
|||||||
// We do this as early as possible because this loads preferences from flash
|
// We do this as early as possible because this loads preferences from flash
|
||||||
// but we need to do this after main cpu init (esp32setup), because we need the random seed set
|
// but we need to do this after main cpu init (esp32setup), because we need the random seed set
|
||||||
nodeDB = new NodeDB;
|
nodeDB = new NodeDB;
|
||||||
|
|
||||||
#if HAS_TFT
|
#if HAS_TFT
|
||||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
||||||
tftSetup();
|
tftSetup();
|
||||||
@@ -834,7 +837,12 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
|
#if defined(PIN_DRV_EN)
|
||||||
|
pinMode(PIN_DRV_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_DRV_EN, HIGH);
|
||||||
|
delay(10);
|
||||||
|
#endif
|
||||||
drv.begin();
|
drv.begin();
|
||||||
drv.selectLibrary(1);
|
drv.selectLibrary(1);
|
||||||
// I2C trigger by sending 'go' command
|
// I2C trigger by sending 'go' command
|
||||||
@@ -1039,6 +1047,24 @@ void setup()
|
|||||||
};
|
};
|
||||||
touchConfig.singlePress = INPUT_BROKER_NONE;
|
touchConfig.singlePress = INPUT_BROKER_NONE;
|
||||||
touchConfig.longPress = INPUT_BROKER_BACK;
|
touchConfig.longPress = INPUT_BROKER_BACK;
|
||||||
|
#if defined(TTGO_T_ECHO_PLUS) && defined(PIN_EINK_EN)
|
||||||
|
// On T-Echo Plus the touch pad should only drive the backlight, not UI navigation/sounds
|
||||||
|
touchConfig.longPress = INPUT_BROKER_NONE;
|
||||||
|
touchConfig.suppressLeadUpSound = true;
|
||||||
|
touchConfig.onPress = []() {
|
||||||
|
touchBacklightWasOn = uiconfig.screen_brightness == 1;
|
||||||
|
if (!touchBacklightWasOn) {
|
||||||
|
digitalWrite(PIN_EINK_EN, HIGH);
|
||||||
|
}
|
||||||
|
touchBacklightActive = true;
|
||||||
|
};
|
||||||
|
touchConfig.onRelease = []() {
|
||||||
|
if (touchBacklightActive && !touchBacklightWasOn) {
|
||||||
|
digitalWrite(PIN_EINK_EN, LOW);
|
||||||
|
}
|
||||||
|
touchBacklightActive = false;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
TouchButtonThread->initButton(touchConfig);
|
TouchButtonThread->initButton(touchConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ extern bool eink_found;
|
|||||||
extern bool pmu_found;
|
extern bool pmu_found;
|
||||||
extern bool isUSBPowered;
|
extern bool isUSBPowered;
|
||||||
|
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
#include <Adafruit_DRV2605.h>
|
#include <Adafruit_DRV2605.h>
|
||||||
extern Adafruit_DRV2605 drv;
|
extern Adafruit_DRV2605 drv;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
delay = EXT_NOTIFICATION_FAST_THREAD_MS;
|
delay = EXT_NOTIFICATION_FAST_THREAD_MS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
drv.go();
|
drv.go();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on)
|
|||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.rgb(red, green, blue);
|
unphone.rgb(red, green, blue);
|
||||||
#endif
|
#endif
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
if (on) {
|
if (on) {
|
||||||
drv.go();
|
drv.go();
|
||||||
} else {
|
} else {
|
||||||
@@ -319,7 +319,7 @@ void ExternalNotificationModule::stopNow()
|
|||||||
externalTurnedOn[i] = 0;
|
externalTurnedOn[i] = 0;
|
||||||
}
|
}
|
||||||
setIntervalFromNow(0);
|
setIntervalFromNow(0);
|
||||||
#if defined(T_WATCH_S3) || defined(T_LORA_PAGER)
|
#ifdef HAS_DRV2605
|
||||||
drv.stop();
|
drv.stop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,9 @@
|
|||||||
SerialModule *serialModule;
|
SerialModule *serialModule;
|
||||||
SerialModuleRadio *serialModuleRadio;
|
SerialModuleRadio *serialModuleRadio;
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \
|
#if defined(TTGO_T_ECHO) || defined(TTGO_T_ECHO_PLUS) || defined(CANARYONE) || defined(MESHLINK) || \
|
||||||
defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) || defined(ELECROW_ThinkNode_M3) || \
|
defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) || \
|
||||||
defined(MUZI_BASE)
|
defined(ELECROW_ThinkNode_M3) || defined(MUZI_BASE)
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial")
|
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial")
|
||||||
{
|
{
|
||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
@@ -204,8 +204,9 @@ int32_t SerialModule::runOnce()
|
|||||||
Serial.begin(baud);
|
Serial.begin(baud);
|
||||||
Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT);
|
Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT);
|
||||||
}
|
}
|
||||||
#elif !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
#elif !defined(TTGO_T_ECHO) && !defined(TTGO_T_ECHO_PLUS) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && \
|
||||||
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
||||||
|
!defined(MUZI_BASE)
|
||||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||||
#ifdef ARCH_RP2040
|
#ifdef ARCH_RP2040
|
||||||
Serial2.setFIFOSize(RX_BUFFER);
|
Serial2.setFIFOSize(RX_BUFFER);
|
||||||
@@ -261,7 +262,7 @@ int32_t SerialModule::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
#if !defined(TTGO_T_ECHO) && !defined(TTGO_T_ECHO_PLUS) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
||||||
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
||||||
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
||||||
processWXSerial();
|
processWXSerial();
|
||||||
@@ -536,9 +537,9 @@ ParsedLine parseLine(const char *line)
|
|||||||
*/
|
*/
|
||||||
void SerialModule::processWXSerial()
|
void SerialModule::processWXSerial()
|
||||||
{
|
{
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
#if !defined(TTGO_T_ECHO) && !defined(TTGO_T_ECHO_PLUS) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && \
|
||||||
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
!defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && \
|
||||||
!defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
!defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
||||||
static unsigned int lastAveraged = 0;
|
static unsigned int lastAveraged = 0;
|
||||||
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
||||||
static double dir_sum_sin = 0;
|
static double dir_sum_sin = 0;
|
||||||
|
|||||||
@@ -66,6 +66,8 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO
|
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO
|
||||||
#elif defined(T_ECHO_LITE)
|
#elif defined(T_ECHO_LITE)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO_LITE
|
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO_LITE
|
||||||
|
#elif defined(TTGO_T_ECHO_PLUS)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO_PLUS
|
||||||
#elif defined(ELECROW_ThinkNode_M1)
|
#elif defined(ELECROW_ThinkNode_M1)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1
|
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1
|
||||||
#elif defined(ELECROW_ThinkNode_M3)
|
#elif defined(ELECROW_ThinkNode_M3)
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#define SCREEN_TRANSITION_FRAMERATE 5 // fps
|
#define SCREEN_TRANSITION_FRAMERATE 5 // fps
|
||||||
#define USE_TFTDISPLAY 1
|
#define USE_TFTDISPLAY 1
|
||||||
|
|
||||||
|
#define HAS_DRV2605 1
|
||||||
|
|
||||||
#define HAS_TOUCHSCREEN 1
|
#define HAS_TOUCHSCREEN 1
|
||||||
#define SCREEN_TOUCH_INT 16
|
#define SCREEN_TOUCH_INT 16
|
||||||
#define SCREEN_TOUCH_USE_I2C1
|
#define SCREEN_TOUCH_USE_I2C1
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#define I2C_SDA SDA
|
#define I2C_SDA SDA
|
||||||
#define I2C_SCL SCL
|
#define I2C_SCL SCL
|
||||||
|
|
||||||
|
#define HAS_DRV2605 1
|
||||||
|
|
||||||
#define USE_POWERSAVE
|
#define USE_POWERSAVE
|
||||||
#define SLEEP_TIME 120
|
#define SLEEP_TIME 120
|
||||||
|
|
||||||
|
|||||||
70
variants/nrf52840/t-echo-plus/nicheGraphics.h
Normal file
70
variants/nrf52840/t-echo-plus/nicheGraphics.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||||
|
|
||||||
|
#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h"
|
||||||
|
#include "graphics/niche/Drivers/EInk/GDEY0154D67.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/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/InkHUD.h"
|
||||||
|
#include "graphics/niche/Inputs/TwoButton.h"
|
||||||
|
|
||||||
|
void setupNicheGraphics()
|
||||||
|
{
|
||||||
|
using namespace NicheGraphics;
|
||||||
|
|
||||||
|
SPI1.begin();
|
||||||
|
|
||||||
|
Drivers::EInk *driver = new Drivers::GDEY0154D67;
|
||||||
|
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||||
|
|
||||||
|
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||||
|
inkhud->setDriver(driver);
|
||||||
|
inkhud->setDisplayResilience(20, 1.5);
|
||||||
|
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
|
||||||
|
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
|
||||||
|
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||||
|
inkhud->persistence->settings.userTiles.maxCount = 2;
|
||||||
|
inkhud->persistence->settings.rotation = 3;
|
||||||
|
inkhud->persistence->settings.optionalFeatures.batteryIcon = true;
|
||||||
|
inkhud->persistence->settings.optionalMenuItems.backlight = true;
|
||||||
|
|
||||||
|
Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance();
|
||||||
|
backlight->setPin(PIN_EINK_BL);
|
||||||
|
|
||||||
|
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true);
|
||||||
|
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);
|
||||||
|
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet);
|
||||||
|
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0);
|
||||||
|
|
||||||
|
inkhud->begin();
|
||||||
|
|
||||||
|
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance();
|
||||||
|
|
||||||
|
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||||
|
buttons->setTiming(0, 75, 500);
|
||||||
|
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||||
|
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||||
|
|
||||||
|
buttons->setWiring(1, PIN_BUTTON_TOUCH);
|
||||||
|
buttons->setTiming(1, 50, 5000);
|
||||||
|
buttons->setHandlerDown(1, [inkhud, backlight]() {
|
||||||
|
backlight->peek();
|
||||||
|
inkhud->persistence->settings.optionalMenuItems.backlight = false;
|
||||||
|
});
|
||||||
|
buttons->setHandlerLongPress(1, [backlight]() { backlight->latch(); });
|
||||||
|
buttons->setHandlerShortPress(1, [backlight]() { backlight->off(); });
|
||||||
|
|
||||||
|
buttons->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
26
variants/nrf52840/t-echo-plus/platformio.ini
Normal file
26
variants/nrf52840/t-echo-plus/platformio.ini
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[env:t-echo-plus]
|
||||||
|
extends = nrf52840_base
|
||||||
|
board = t-echo
|
||||||
|
board_level = pr
|
||||||
|
board_check = true
|
||||||
|
debug_tool = jlink
|
||||||
|
|
||||||
|
build_flags = ${nrf52840_base.build_flags}
|
||||||
|
-DTTGO_T_ECHO_PLUS
|
||||||
|
-Ivariants/nrf52840/t-echo-plus
|
||||||
|
-DEINK_DISPLAY_MODEL=GxEPD2_154_D67
|
||||||
|
-DEINK_WIDTH=200
|
||||||
|
-DEINK_HEIGHT=200
|
||||||
|
-DUSE_EINK
|
||||||
|
-DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk
|
||||||
|
-DEINK_LIMIT_FASTREFRESH=20 ; How many consecutive fast-refreshes are permitted
|
||||||
|
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
|
||||||
|
-DI2C_NO_RESCAN
|
||||||
|
|
||||||
|
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/t-echo-plus>
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${nrf52840_base.lib_deps}
|
||||||
|
https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip
|
||||||
|
lewisxhe/PCF8563_Library@^1.0.1
|
||||||
|
adafruit/Adafruit DRV2605 Library@1.2.4
|
||||||
24
variants/nrf52840/t-echo-plus/variant.cpp
Normal file
24
variants/nrf52840/t-echo-plus/variant.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "variant.h"
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "wiring_constants.h"
|
||||||
|
#include "wiring_digital.h"
|
||||||
|
|
||||||
|
const uint32_t g_ADigitalPinMap[] = {
|
||||||
|
// P0 - pins 0 and 1 are hardwired for xtal and should never be enabled
|
||||||
|
0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
|
||||||
|
// P1
|
||||||
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
// LEDs (if populated)
|
||||||
|
pinMode(PIN_LED1, OUTPUT);
|
||||||
|
ledOff(PIN_LED1);
|
||||||
|
|
||||||
|
pinMode(PIN_LED2, OUTPUT);
|
||||||
|
ledOff(PIN_LED2);
|
||||||
|
|
||||||
|
pinMode(PIN_LED3, OUTPUT);
|
||||||
|
ledOff(PIN_LED3);
|
||||||
|
}
|
||||||
145
variants/nrf52840/t-echo-plus/variant.h
Normal file
145
variants/nrf52840/t-echo-plus/variant.h
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
#ifndef _VARIANT_T_ECHO_PLUS_
|
||||||
|
#define _VARIANT_T_ECHO_PLUS_
|
||||||
|
|
||||||
|
#define VARIANT_MCK (64000000ul)
|
||||||
|
#define USE_LFXO
|
||||||
|
|
||||||
|
#include "WVariant.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Pin counts
|
||||||
|
#define PINS_COUNT (48)
|
||||||
|
#define NUM_DIGITAL_PINS (48)
|
||||||
|
#define NUM_ANALOG_INPUTS (1)
|
||||||
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
|
// LEDs (not documented on pinmap; keep defaults for compatibility)
|
||||||
|
#define PIN_LED1 (0 + 14)
|
||||||
|
#define PIN_LED2 (0 + 15)
|
||||||
|
#define PIN_LED3 (0 + 13)
|
||||||
|
|
||||||
|
#define LED_RED PIN_LED3
|
||||||
|
#define LED_BLUE PIN_LED1
|
||||||
|
#define LED_GREEN PIN_LED2
|
||||||
|
|
||||||
|
#define LED_BUILTIN LED_BLUE
|
||||||
|
#define LED_CONN LED_GREEN
|
||||||
|
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
|
// Buttons / touch
|
||||||
|
#define PIN_BUTTON1 (32 + 10)
|
||||||
|
#define BUTTON_ACTIVE_LOW true
|
||||||
|
#define BUTTON_ACTIVE_PULLUP true
|
||||||
|
#define PIN_BUTTON2 (0 + 18) // reset-labelled but usable as GPIO
|
||||||
|
#define PIN_BUTTON_TOUCH (0 + 11) // capacitive touch
|
||||||
|
#define BUTTON_TOUCH_ACTIVE_LOW true
|
||||||
|
#define BUTTON_TOUCH_ACTIVE_PULLUP true
|
||||||
|
|
||||||
|
#define BUTTON_CLICK_MS 400
|
||||||
|
#define BUTTON_TOUCH_MS 200
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
#define PIN_A0 (4)
|
||||||
|
#define BATTERY_PIN PIN_A0
|
||||||
|
static const uint8_t A0 = PIN_A0;
|
||||||
|
#define ADC_RESOLUTION 14
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||||
|
#define BATTERY_SENSE_RESOLUTION 4096.0
|
||||||
|
#undef AREF_VOLTAGE
|
||||||
|
#define AREF_VOLTAGE 3.0
|
||||||
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
#define ADC_MULTIPLIER (2.0F)
|
||||||
|
|
||||||
|
// NFC
|
||||||
|
#define PIN_NFC1 (9)
|
||||||
|
#define PIN_NFC2 (10)
|
||||||
|
|
||||||
|
// I2C (IMU BHI260AP, RTC, etc.)
|
||||||
|
#define WIRE_INTERFACES_COUNT 1
|
||||||
|
#define PIN_WIRE_SDA (0 + 26)
|
||||||
|
#define PIN_WIRE_SCL (0 + 27)
|
||||||
|
#define HAS_BHI260AP
|
||||||
|
|
||||||
|
#define TP_SER_IO (0 + 11)
|
||||||
|
|
||||||
|
// RTC interrupt
|
||||||
|
#define PIN_RTC_INT (0 + 16)
|
||||||
|
|
||||||
|
// QSPI flash
|
||||||
|
#define PIN_QSPI_SCK (32 + 14)
|
||||||
|
#define PIN_QSPI_CS (32 + 15)
|
||||||
|
#define PIN_QSPI_IO0 (32 + 12)
|
||||||
|
#define PIN_QSPI_IO1 (32 + 13)
|
||||||
|
#define PIN_QSPI_IO2 (0 + 7)
|
||||||
|
#define PIN_QSPI_IO3 (0 + 5)
|
||||||
|
|
||||||
|
// On-board QSPI Flash
|
||||||
|
#define EXTERNAL_FLASH_DEVICES MX25R1635F
|
||||||
|
#define EXTERNAL_FLASH_USE_QSPI
|
||||||
|
|
||||||
|
// LoRa SX1262
|
||||||
|
#define USE_SX1262
|
||||||
|
#define USE_SX1268
|
||||||
|
#define SX126X_CS (0 + 24)
|
||||||
|
#define SX126X_DIO1 (0 + 20)
|
||||||
|
#define SX1262_DIO3 (0 + 21)
|
||||||
|
#define SX126X_BUSY (0 + 17)
|
||||||
|
#define SX126X_RESET (0 + 25)
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||||
|
#define TCXO_OPTIONAL
|
||||||
|
|
||||||
|
#define SPI_INTERFACES_COUNT 2
|
||||||
|
|
||||||
|
#define PIN_SPI_MISO (0 + 23)
|
||||||
|
#define PIN_SPI_MOSI (0 + 22)
|
||||||
|
#define PIN_SPI_SCK (0 + 19)
|
||||||
|
|
||||||
|
// E-paper (1.54" per pinmap)
|
||||||
|
// Alias PIN_EINK_EN to keep common eink power control code working
|
||||||
|
#define PIN_EINK_BL (32 + 11) // backlight / panel power switch
|
||||||
|
#define PIN_EINK_EN PIN_EINK_BL
|
||||||
|
#define PIN_EINK_CS (0 + 30)
|
||||||
|
#define PIN_EINK_BUSY (0 + 3)
|
||||||
|
#define PIN_EINK_DC (0 + 28)
|
||||||
|
#define PIN_EINK_RES (0 + 2)
|
||||||
|
#define PIN_EINK_SCLK (0 + 31)
|
||||||
|
#define PIN_EINK_MOSI (0 + 29) // also called SDI
|
||||||
|
|
||||||
|
// Power control
|
||||||
|
#define PIN_POWER_EN (0 + 12)
|
||||||
|
|
||||||
|
#define PIN_SPI1_MISO (32 + 7) // Placeholder MISO; keep off QSPI pins to avoid contention
|
||||||
|
#define PIN_SPI1_MOSI PIN_EINK_MOSI
|
||||||
|
#define PIN_SPI1_SCK PIN_EINK_SCLK
|
||||||
|
|
||||||
|
// GPS (TX/RX/Wake/Reset/PPS per pinmap)
|
||||||
|
#define GPS_L76K
|
||||||
|
#define PIN_GPS_REINIT (32 + 5) // Reset
|
||||||
|
#define PIN_GPS_STANDBY (32 + 2) // Wake
|
||||||
|
#define PIN_GPS_PPS (32 + 4)
|
||||||
|
#define GPS_TX_PIN (32 + 8)
|
||||||
|
#define GPS_RX_PIN (32 + 9)
|
||||||
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
|
#define PIN_SERIAL1_RX GPS_RX_PIN
|
||||||
|
#define PIN_SERIAL1_TX GPS_TX_PIN
|
||||||
|
|
||||||
|
// Sensors / accessories
|
||||||
|
#define PIN_BUZZER (0 + 6)
|
||||||
|
#define PIN_DRV_EN (0 + 8)
|
||||||
|
|
||||||
|
#define HAS_DRV2605 1
|
||||||
|
|
||||||
|
// Battery / ADC already defined above
|
||||||
|
#define HAS_RTC 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user