MeshPocket source code update

This commit is contained in:
Heltec-Aaron-Lee 2025-04-10 16:24:20 +08:00
parent 41827683d0
commit 69c41afb14
6 changed files with 47 additions and 48 deletions

View File

@ -176,16 +176,11 @@ bool EInkDisplay::connect()
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) || defined(HELTEC_MESH_POCKET)
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
{
#if defined(HELTEC_MESH_POCKET)
hspi=&SPI1;
hspi->begin();
#else
// Start HSPI
hspi = new SPIClass(HSPI);
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS
#endif
// VExt already enabled in setup()
// RTC GPIO hold disabled in setup()
@ -222,6 +217,21 @@ bool EInkDisplay::connect()
adafruitDisplay->setRotation(1);
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
}
#elif defined(HELTEC_MESH_POCKET)
{
spi1=&SPI1;
spi1->begin();
// VExt already enabled in setup()
// RTC GPIO hold disabled in setup()
// Create GxEPD2 objects
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1);
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
// Init GxEPD2
adafruitDisplay->init();
adafruitDisplay->setRotation(3);
}
#endif
return true;

View File

@ -69,10 +69,14 @@ class EInkDisplay : public OLEDDisplay
// If display uses HSPI
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) || defined(HELTEC_MESH_POCKET)
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
SPIClass *hspi = NULL;
#endif
#if defined(HELTEC_MESH_POCKET)
SPIClass *spi1 = NULL;
#endif
private:
// FIXME quick hack to limit drawing to a very slow rate
uint32_t lastDrawMsec = 0;

View File

@ -1,11 +1,11 @@
#include "./MESHPOCKET_SSD1680.h"
#include "./LCMEN2R13ECC1.h"
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
using namespace NicheGraphics::Drivers;
// Map the display controller IC's output to the connected panel
void MESHPOCKET_SSD1680::configScanning()
void LCMEN2R13ECC1::configScanning()
{
// "Driver output control"
sendCommand(0x01);
@ -14,22 +14,22 @@ void MESHPOCKET_SSD1680::configScanning()
sendData(0x00);
// To-do: delete this method?
// Values set here might be redundant: C7, 00, 00 seems to be default
// Values set here might be redundant: F9, 00, 00 seems to be default
}
// Specify which information is used to control the sequence of voltages applied to move the pixels
// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from
// the controller IC's OTP memory, when the update procedure begins.
void MESHPOCKET_SSD1680::configWaveform()
void LCMEN2R13ECC1::configWaveform()
{
sendCommand(0x3C); // Border waveform:
sendData(0x85); // Screen border should follow LUT1 waveform (actively drive pixels white)
sendData(0x85);
sendCommand(0x18); // Temperature sensor:
sendData(0x80); // Use internal temperature sensor to select an appropriate refresh waveform
}
void MESHPOCKET_SSD1680::configUpdateSequence()
void LCMEN2R13ECC1::configUpdateSequence()
{
switch (updateType) {
case FAST:
@ -48,18 +48,18 @@ void MESHPOCKET_SSD1680::configUpdateSequence()
// Once the refresh operation has been started,
// begin periodically polling the display to check for completion, using the normal Meshtastic threading code
// Only used when refresh is "async"
void MESHPOCKET_SSD1680::detachFromUpdate()
void LCMEN2R13ECC1::detachFromUpdate()
{
switch (updateType) {
case FAST:
return beginPolling(50, 500); // At least 500ms for fast refresh
return beginPolling(50, 800); // At least 500ms for fast refresh
case FULL:
default:
return beginPolling(100, 2000); // At least 2 seconds for full refresh
return beginPolling(100, 2500); // At least 2 seconds for full refresh
}
}
void MESHPOCKET_SSD1680::update(uint8_t *imageData, UpdateTypes type)
void LCMEN2R13ECC1::update(uint8_t *imageData, UpdateTypes type)
{
this->updateType = type;
this->buffer = imageData;
@ -68,18 +68,15 @@ void MESHPOCKET_SSD1680::update(uint8_t *imageData, UpdateTypes type)
configFullscreen();
configScanning(); // Virtual, unused by base class
configVoltages(); // Virtual, unused by base class
configWaveform(); // Virtual, unused by base class
wait();
if (updateType == FULL) {
sendCommand(0x12); // Begin executing the update
wait();
configFullscreen();
wait();
writeNewImage();
writeOldImage();
} else {
configVoltages(); // Virtual, unused by base class
configWaveform(); // Virtual, unused by base class
wait();
writeNewImage();
}
@ -91,16 +88,4 @@ void MESHPOCKET_SSD1680::update(uint8_t *imageData, UpdateTypes type)
detachFromUpdate();
}
// void MESHPOCKET_SSD1680::finalizeUpdate()
// {
// // Put a copy of the image into the "old memory".
// // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place
// // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc.
// if (updateType != FULL) {
// // writeNewImage(); // Not required for this display
// writeOldImage();
// sendCommand(0x7F); // Terminate image write without update
// wait();
// }
// }
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS

View File

@ -2,10 +2,10 @@
E-Ink display driver
- SSD1680
- Manufacturer: DKE
- Manufacturer: WISEVAST
- Size: 2.13 inch
- Resolution: 122px x 255px
- Flex connector marking: FPC-7519 rev.b
- Flex connector marking: Soldering connector, no connector is needed
*/
@ -19,7 +19,7 @@ E-Ink display driver
namespace NicheGraphics::Drivers
{
class MESHPOCKET_SSD1680 : public SSD16XX
class LCMEN2R13ECC1 : public SSD16XX
{
// Display properties
private:
@ -28,7 +28,7 @@ class MESHPOCKET_SSD1680 : public SSD16XX
static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST);
public:
MESHPOCKET_SSD1680() : SSD16XX(width, height, supported, 1) {} // Note: left edge of this display is offset by 1 byte
LCMEN2R13ECC1() : SSD16XX(width, height, supported, 1) {} // Note: left edge of this display is offset by 1 byte
protected:
virtual void update(uint8_t *imageData, UpdateTypes type) override;

View File

@ -27,9 +27,9 @@
#elif defined(TRACKER_T1000_E)
#define OCV_ARRAY 4190, 4078, 4017, 3969, 3887, 3818, 3798, 3791, 3766, 3712, 3100
#elif defined(HELTEC_MESH_POCKET_BATTERY_5000)
#define OCV_ARRAY 4420, 4240, 4120, 4000, 3888, 3800, 3740, 3698, 3655, 3580, 3400
#define OCV_ARRAY 4300, 4240, 4120, 4000, 3888, 3800, 3740, 3698, 3655, 3580, 3400
#elif defined(HELTEC_MESH_POCKET_BATTERY_10000)
#define OCV_ARRAY 4300, 4060, 3960, 3840, 3729, 3625, 3550, 3500, 3420, 3345, 3100
#define OCV_ARRAY 4100, 4060, 3960, 3840, 3729, 3625, 3550, 3500, 3420, 3345, 3100
#else // LiIon
#define OCV_ARRAY 4190, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100
#endif

View File

@ -21,7 +21,7 @@
// Shared NicheGraphics components
// --------------------------------
#include "graphics/niche/Drivers/EInk/MESHPOCKET_SSD1680.h"
#include "graphics/niche/Drivers/EInk/LCMEN2R13ECC1.h"
#include "graphics/niche/Inputs/TwoButton.h"
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
@ -34,15 +34,15 @@ void setupNicheGraphics()
// SPI
// -----------------------------
SPIClass *hspi=&SPI1;
hspi->begin();
// Display is connected to HSPI
SPIClass *spi1=&SPI1;
spi1->begin();
// Display is connected to SPI1
// E-Ink Driver
// -----------------------------
// Use E-Ink driver
Drivers::EInk *driver = new Drivers::MESHPOCKET_SSD1680;
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
Drivers::EInk *driver = new Drivers::LCMEN2R13ECC1;
driver->begin(spi1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
// InkHUD
// ----------------------------
@ -69,7 +69,7 @@ void setupNicheGraphics()
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 = false; // Behavior handled by aux button instead
inkhud->persistence->settings.optionalMenuItems.nextTile = true;
// Pick applets
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown