From b8e7c6ee7ae8f44112b31bed62fe1248d8468d5e Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 11:09:21 +0200 Subject: [PATCH 01/15] Update platformio.ini --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 1ff5e92ce..5d991fe38 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,6 +20,7 @@ default_envs = tbeam ;default_envs = pca10059_diy_eink ;default_envs = meshtastic-diy-v1 ;default_envs = meshtastic-diy-v1.1 +;default_envs = m5stack-coreink extra_configs = variants/*/platformio.ini From 1f7fee8e2ad6bc2f54fb6d96f8056688411a864f Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 11:10:49 +0200 Subject: [PATCH 02/15] Create platformio.ini --- variants/m5stack_coreink/platformio.ini | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 variants/m5stack_coreink/platformio.ini diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini new file mode 100644 index 000000000..d23ee79c2 --- /dev/null +++ b/variants/m5stack_coreink/platformio.ini @@ -0,0 +1,14 @@ +[env:m5stack-coreink] +extends = esp32_base +board = m5stack-coreink +build_flags = + ${esp32_base.build_flags} -D PRIVATE_HW -I variants/m5stack_coreink + ;-D RADIOLIB_VERBOSE + -Ofast + -D__MCUXPRESSO +lib_deps = + ${esp32_base.lib_deps} + zinggjm/GxEPD2@^1.4.5 +board_build.f_cpu = 240000000L +upload_protocol = esptool +upload_port = /dev/ttyACM* From a7fbe024e4900979c9864051b21fc10d08dff1bd Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 11:12:45 +0200 Subject: [PATCH 03/15] Create variant.h --- variants/m5stack_coreink/variant.h | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 variants/m5stack_coreink/variant.h diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h new file mode 100644 index 000000000..f52b1bf1f --- /dev/null +++ b/variants/m5stack_coreink/variant.h @@ -0,0 +1,44 @@ +#define I2C_SDA 32 //-1 +#define I2C_SCL 33 //-1 + +//#define LED_PIN 10 + +#define BUTTON_NEED_PULLUP +#define BUTTON_PIN 5 + +//Wheel +// Down 37 +// Push 38 +// Up 39 + +// Top Physical Button 5 + +#undef RF95_SCK +#undef RF95_MISO +#undef RF95_MOSI +#undef RF95_NSS +#define USE_RF95 + +#define RF95_SCK 18 //13 +#define RF95_MISO 34 //26 +#define RF95_MOSI 23 //25 +#define RF95_NSS 14 +#define LORA_DIO0 25 //32 now moved from ext port +#define LORA_RESET 26 //33 now moved from ext port +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC + +#define NO_GPS +// This board has no GPS for now +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define HAS_EINK +//https://docs.m5stack.com/en/core/coreink +#define PIN_EINK_EN -1 +#define PIN_EINK_CS 9 // EPD_CS +#define PIN_EINK_BUSY 4 // EPD_BUSY +#define PIN_EINK_DC 15 // EPD_D/C +#define PIN_EINK_RES -1 // Connected to GPIO0 but no needed !!!! maybe causing issue ? +#define PIN_EINK_SCLK 18 // EPD_SCLK +#define PIN_EINK_MOSI 23 // EPD_MOSI From b9f25eb85cee2712da5ff20ab17a92677e079e32 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 11:21:09 +0200 Subject: [PATCH 04/15] Update EInkDisplay2.cpp --- src/graphics/EInkDisplay2.cpp | 44 +++++++++++++---------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 073b313cd..71606d448 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -31,6 +31,11 @@ //4.2 inch 300x400 - GxEPD2_420_M01 #define TECHO_DISPLAY_MODEL GxEPD2_420_M01 +#elif defined(PRIVATE_HW) +//M5Stack CoreInk +//1.54 inch 200x200 - GxEPD2_154_M09 +#define TECHO_DISPLAY_MODEL GxEPD2_154_M09 + #endif GxEPD2_BW *adafruitDisplay; @@ -58,6 +63,12 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) //GxEPD2_420_M01 setGeometry(GEOMETRY_RAWMODE, 300, 400); + #elif defined(PRIVATE_HW) + + //M5Stack_CoreInk 200x200 + //1.54 inch 200x200 - GxEPD2_154_M09 + setGeometry(GEOMETRY_RAWMODE, 200, 200); + #endif // setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution // setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does @@ -108,7 +119,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit) // 4.2 inch 300x400 - GxEPD2_420_M01 //adafruitDisplay->nextPage(); - #elif defined(PCA10059) + #elif defined(PCA10059) || defined(PRIVATE_HW) adafruitDisplay->nextPage(); #endif @@ -180,40 +191,15 @@ bool EInkDisplay::connect() adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates adafruitDisplay->setRotation(3); //For 1.54, 2.9 and 4.2 //adafruitDisplay->setRotation(1); - - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + //adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } else { (void)adafruitDisplay; } } -#elif defined(PCA10059) +#elif defined(PCA10059) || defined(PRIVATE_HW) { auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); adafruitDisplay = new GxEPD2_BW(*lowLevel); @@ -221,6 +207,8 @@ bool EInkDisplay::connect() adafruitDisplay->setRotation(3); adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } +#elif defined(PRIVATE_HW) + adafruitDisplay->setRotation(0); #endif From b34b26518b03c498fc4a3dba86c9faa21f624e5c Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 11:28:18 +0200 Subject: [PATCH 05/15] Update EInkDisplay2.cpp --- src/graphics/EInkDisplay2.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 71606d448..ba5ecc702 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -199,7 +199,7 @@ bool EInkDisplay::connect() (void)adafruitDisplay; } } -#elif defined(PCA10059) || defined(PRIVATE_HW) +#elif defined(PCA10059) { auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); adafruitDisplay = new GxEPD2_BW(*lowLevel); @@ -208,7 +208,12 @@ bool EInkDisplay::connect() adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } #elif defined(PRIVATE_HW) - adafruitDisplay->setRotation(0); + auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); + adafruitDisplay = new GxEPD2_BW(*lowLevel); + adafruitDisplay->init(115200, true, 10, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0)); + adafruitDisplay->setRotation(0); + adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + #endif From fe8bfdb7625be48d08c18a472be85426998ad1cd Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 17:48:31 +0200 Subject: [PATCH 06/15] Update variant.h --- variants/m5stack_coreink/variant.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index f52b1bf1f..b7894741e 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -1,8 +1,11 @@ -#define I2C_SDA 32 //-1 -#define I2C_SCL 33 //-1 +#define I2C_SDA 21 //-1 +#define I2C_SCL 22 //-1 //#define LED_PIN 10 +// PCF8563 RTC Module +#define PCF8563_RTC 0x51 + #define BUTTON_NEED_PULLUP #define BUTTON_PIN 5 From f33e6a0e6639185c437c43a81f73bdb3c185557f Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 17:49:10 +0200 Subject: [PATCH 07/15] Update platformio.ini --- variants/m5stack_coreink/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini index d23ee79c2..a8f01edea 100644 --- a/variants/m5stack_coreink/platformio.ini +++ b/variants/m5stack_coreink/platformio.ini @@ -9,6 +9,7 @@ build_flags = lib_deps = ${esp32_base.lib_deps} zinggjm/GxEPD2@^1.4.5 + lewisxhe/PCF8563_Library@^0.0.1 board_build.f_cpu = 240000000L upload_protocol = esptool upload_port = /dev/ttyACM* From 95f091041b45d1533723fbe97ad707edf3c17f1c Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 17:53:19 +0200 Subject: [PATCH 08/15] Update variant.h --- variants/m5stack_coreink/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index b7894741e..17339fe83 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -1,7 +1,7 @@ #define I2C_SDA 21 //-1 #define I2C_SCL 22 //-1 -//#define LED_PIN 10 +#define LED_PIN 10 // PCF8563 RTC Module #define PCF8563_RTC 0x51 From c7a9ce7f49ef4edd1a6403079e89873861b92c6a Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 18:08:13 +0200 Subject: [PATCH 09/15] Update variant.h --- variants/m5stack_coreink/variant.h | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index 17339fe83..c0276485f 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -38,6 +38,7 @@ #define HAS_EINK //https://docs.m5stack.com/en/core/coreink +//https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/coreink/coreink_sch.pdf #define PIN_EINK_EN -1 #define PIN_EINK_CS 9 // EPD_CS #define PIN_EINK_BUSY 4 // EPD_BUSY From 5828e6f423d53e60f0598a0f4c88c6546221653e Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 18:08:40 +0200 Subject: [PATCH 10/15] Update variant.h --- variants/m5stack_coreink/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index c0276485f..16f0bc6cf 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -1,7 +1,7 @@ #define I2C_SDA 21 //-1 #define I2C_SCL 22 //-1 -#define LED_PIN 10 +//#define LED_PIN 10 // PCF8563 RTC Module #define PCF8563_RTC 0x51 From 0d09767efdba4a77271b44794bb15bc51d3a0935 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 18:11:06 +0200 Subject: [PATCH 11/15] Update variant.h --- variants/m5stack_coreink/variant.h | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h index 16f0bc6cf..ff9eda6f4 100644 --- a/variants/m5stack_coreink/variant.h +++ b/variants/m5stack_coreink/variant.h @@ -3,6 +3,7 @@ //#define LED_PIN 10 +#include "pcf8563.h" // PCF8563 RTC Module #define PCF8563_RTC 0x51 From 9512ea45de18575cc27d8ae99d7d0a818cf61856 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 19:27:38 +0200 Subject: [PATCH 12/15] Update EInkDisplay2.cpp --- src/graphics/EInkDisplay2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index ba5ecc702..20abc8947 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -192,7 +192,7 @@ bool EInkDisplay::connect() //RAK14000 2.13 inch b/w 250x122 does not support partial updates adafruitDisplay->setRotation(3); - //For 1.54, 2.9 and 4.2 + //For 1.54, 2.9 and 4.2 with Partial Updates //adafruitDisplay->setRotation(1); //adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } else { From 4e813b098a52ba73d2bc1a48a87f6bd39e263276 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 20:30:21 +0200 Subject: [PATCH 13/15] Update platformio.ini --- variants/m5stack_coreink/platformio.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini index a8f01edea..a6a35d80e 100644 --- a/variants/m5stack_coreink/platformio.ini +++ b/variants/m5stack_coreink/platformio.ini @@ -2,10 +2,13 @@ extends = esp32_base board = m5stack-coreink build_flags = - ${esp32_base.build_flags} -D PRIVATE_HW -I variants/m5stack_coreink + ${esp32_base.build_flags} -D M5_COREINK -I variants/m5stack_coreink ;-D RADIOLIB_VERBOSE -Ofast -D__MCUXPRESSO + -DEPD_HEIGHT=200 + -DEPD_WIDTH=200 + -DM5STACK lib_deps = ${esp32_base.lib_deps} zinggjm/GxEPD2@^1.4.5 From c7dfd245e399122dda1a9014484de2b4c20b4667 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 20:31:39 +0200 Subject: [PATCH 14/15] Update EInkDisplay2.cpp --- src/graphics/EInkDisplay2.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 20abc8947..eac336290 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -31,7 +31,7 @@ //4.2 inch 300x400 - GxEPD2_420_M01 #define TECHO_DISPLAY_MODEL GxEPD2_420_M01 -#elif defined(PRIVATE_HW) +#elif defined(M5_COREINK) //M5Stack CoreInk //1.54 inch 200x200 - GxEPD2_154_M09 #define TECHO_DISPLAY_MODEL GxEPD2_154_M09 @@ -63,12 +63,13 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) //GxEPD2_420_M01 setGeometry(GEOMETRY_RAWMODE, 300, 400); - #elif defined(PRIVATE_HW) + #elif defined(M5_COREINK) //M5Stack_CoreInk 200x200 //1.54 inch 200x200 - GxEPD2_154_M09 - setGeometry(GEOMETRY_RAWMODE, 200, 200); - + //setGeometry(GEOMETRY_RAWMODE, 200, 200); + setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH); + #endif // setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution // setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does @@ -119,7 +120,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit) // 4.2 inch 300x400 - GxEPD2_420_M01 //adafruitDisplay->nextPage(); - #elif defined(PCA10059) || defined(PRIVATE_HW) + #elif defined(PCA10059) || defined(M5_COREINK) adafruitDisplay->nextPage(); #endif @@ -192,7 +193,7 @@ bool EInkDisplay::connect() //RAK14000 2.13 inch b/w 250x122 does not support partial updates adafruitDisplay->setRotation(3); - //For 1.54, 2.9 and 4.2 with Partial Updates + //For 1.54, 2.9 and 4.2 //adafruitDisplay->setRotation(1); //adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } else { @@ -207,13 +208,12 @@ bool EInkDisplay::connect() adafruitDisplay->setRotation(3); adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } -#elif defined(PRIVATE_HW) +#elif defined(M5_COREINK) auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); adafruitDisplay = new GxEPD2_BW(*lowLevel); adafruitDisplay->init(115200, true, 10, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0)); adafruitDisplay->setRotation(0); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - + adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT); #endif From 48ee995e0d3ac03872e51b1537faf9f887e2ca47 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Wed, 1 Jun 2022 20:33:51 +0200 Subject: [PATCH 15/15] Update EInkDisplay2.cpp --- src/graphics/EInkDisplay2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index eac336290..ef6bac4cf 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -67,7 +67,6 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) //M5Stack_CoreInk 200x200 //1.54 inch 200x200 - GxEPD2_154_M09 - //setGeometry(GEOMETRY_RAWMODE, 200, 200); setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH); #endif