Skip to content

Commit a2efdd4

Browse files
authored
Merge pull request #46 from tobozo/M5CoreS3
S3Box + M5Stack CoreS3 support
2 parents 24f5c13 + 21c1d0b commit a2efdd4

File tree

14 files changed

+100
-17
lines changed

14 files changed

+100
-17
lines changed

.github/workflows/build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- esp32:esp32:m5stack-fire
3434
- esp32:esp32:m5stack-core2
3535
- esp32:esp32:odroid_esp32:PartitionScheme=min_spiffs
36+
- esp32:esp32:esp32s3box
3637

3738
platform-url:
3839
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
@@ -53,6 +54,9 @@ jobs:
5354
- arduino-boards-fqbn: esp32:esp32:odroid_esp32:PartitionScheme=min_spiffs
5455
fancy-name: OdroidGo
5556
bin-name: OdroidGo-BLECollector.bin
57+
- arduino-boards-fqbn: esp32:esp32:esp32s3box
58+
fancy-name: S3Box
59+
bin-name: S3Box-BLECollector.bin
5660

5761
fail-fast: false
5862

ESP32-BLECollector/BLE.h

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
3030
*/
3131

32+
#pragma GCC diagnostic ignored "-Wunused-variable"
33+
3234
#define TICKS_TO_DELAY 1000
3335

3436
const char* processTemplateLong = "%s%d%s%d";
@@ -893,6 +895,7 @@ class BLEScanUtils
893895
vTaskDelete(NULL);
894896
}
895897

898+
#if defined USE_SCREENSHOTS
896899
static void screenShotCB( void * param = NULL )
897900
{
898901
xTaskCreate(screenShotTask, "screenShotTask", 16000, NULL, 2, NULL);
@@ -904,6 +907,7 @@ class BLEScanUtils
904907
log_w("Cold ScreenShot");
905908
M5.ScreenShot->init(/* &M5.Lcd, BLE_FS */);
906909
if( M5.ScreenShot->begin() ) {
910+
log_w("ScreenShot Service loaded");
907911
UI.ScreenShotLoaded = true;
908912
UI.screenShot();
909913
} else {
@@ -915,6 +919,7 @@ class BLEScanUtils
915919
}
916920
vTaskDelete(NULL);
917921
}
922+
#endif
918923

919924
static void setTimeZone( void * param = NULL )
920925
{
@@ -1044,7 +1049,12 @@ class BLEScanUtils
10441049
{ "ls", o->listDirCB, "Show [dir] Content on the SD" },
10451050
{ "rm", o->rmFileCB, "Delete [file] from the SD" },
10461051
{ "restart", o->restartCB, "Restart BLECollector ('restart now' to skip replication)" },
1052+
1053+
#if defined USE_SCREENSHOTS
10471054
{ "screenshot", o->screenShotCB, "Make a screenshot and save it on the SD" },
1055+
#endif
1056+
1057+
10481058
{ "screenshow", o->screenShowCB, "Show screenshot" },
10491059
{ "toggle", o->toggleCB, "toggle a bool value" },
10501060
{ "resetDB", o->resetCB, "Hard Reset DB + forced restart" },

ESP32-BLECollector/BLECache.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
*
5858
\*/
5959

60-
60+
#pragma GCC diagnostic ignored "-Wunused-variable"
6161

6262
struct BLEGATTService
6363
{

ESP32-BLECollector/BLEFileSharing.h

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*/
3131

3232
#pragma GCC diagnostic ignored "-Wunused-function"
33+
#pragma GCC diagnostic ignored "-Wunused-variable"
3334

3435

3536
#define TICKS_TO_DELAY 1000

ESP32-BLECollector/DB.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
3030
*/
3131

32-
32+
#pragma GCC diagnostic ignored "-Wunused-variable"
3333

3434

3535
const char* data = 0; // for some reason sqlite3 db callback needs this

ESP32-BLECollector/Display.h

+54-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#if defined ARDUINO_M5Stack_Core_ESP32 \
44
|| defined ARDUINO_M5STACK_Core2 \
5+
|| defined ARDUINO_M5STACK_CORES3 \
56
|| defined ARDUINO_M5STACK_FIRE \
67
|| defined ARDUINO_ODROID_ESP32 \
78
|| defined ARDUINO_ESP32_DEV \
@@ -13,6 +14,7 @@
1314
|| defined ARDUINO_TWATCH_2020_V1 \
1415
|| defined ARDUINO_TWATCH_2020_V2 \
1516
|| defined ARDUINO_LOLIN_D32_PRO \
17+
|| defined ARDUINO_ESP32_S3_BOX \
1618
// yay! platform is supported
1719
#else
1820
#error "NO SUPPORTED BOARD DETECTED !!"
@@ -51,7 +53,7 @@ static const int AMIGABALL_YPOS = 50;
5153

5254

5355
// display profiles switcher
54-
#if defined( ARDUINO_M5Stack_Core_ESP32 ) || defined( ARDUINO_M5STACK_FIRE ) || defined( ARDUINO_ODROID_ESP32 ) || defined( ARDUINO_M5STACK_Core2 ) || defined( ARDUINO_LOLIN_D32_PRO )
56+
#if defined( ARDUINO_M5Stack_Core_ESP32 ) || defined( ARDUINO_M5STACK_FIRE ) || defined( ARDUINO_ODROID_ESP32 ) || defined( ARDUINO_M5STACK_Core2 ) || defined( ARDUINO_LOLIN_D32_PRO ) || defined ARDUINO_ESP32_S3_BOX || defined ARDUINO_M5STACK_CORES3
5557

5658
#if defined ARDUINO_M5Stack_Core_ESP32
5759
//#undef WITH_WIFI // M5Stack has a small partition, disable WiFi
@@ -70,7 +72,7 @@ static const int AMIGABALL_YPOS = 50;
7072
#undef hasHID
7173
#define hasHID() (bool)false
7274

73-
#elif defined( ARDUINO_ODROID_ESP32 ) // M5Core2
75+
#elif defined( ARDUINO_ODROID_ESP32 ) // Odroid-Go
7476

7577
#undef WITH_WIFI // NTP is useless without a RTC module
7678
#undef TIME_UPDATE_SOURCE // disable time update accordingly
@@ -79,7 +81,21 @@ static const int AMIGABALL_YPOS = 50;
7981
#define tft_initOrientation() tft.setRotation(0)
8082
#undef USE_SD_UPDATER // Odroid-Go prefers CrashOverride's Application Loader
8183

82-
#elif defined( ARDUINO_M5STACK_Core2 ) // M5Core2
84+
#elif defined ARDUINO_M5STACK_CORES3 // M5CoreS3
85+
86+
#undef HAS_EXTERNAL_RTC
87+
#define HAS_EXTERNAL_RTC false
88+
#undef BASE_BRIGHTNESS
89+
#define BASE_BRIGHTNESS 100
90+
91+
#elif defined ARDUINO_M5STACK_Core2 // M5Core2
92+
93+
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 6)
94+
// espressif bloated the WiFi core since 2.0.7, now throwing
95+
// an "IRAM0 segment data does not fit" linking error when used with NimBLE
96+
#undef WITH_WIFI
97+
#endif
98+
8399
#undef HAS_EXTERNAL_RTC
84100
#define HAS_EXTERNAL_RTC true
85101
#undef RTC_SDA
@@ -105,6 +121,18 @@ static const int AMIGABALL_YPOS = 50;
105121
//#undef HEAPGRAPH_CORE
106122
//#define HEAPGRAPH_CORE 0
107123

124+
125+
#elif defined ARDUINO_ESP32_S3_BOX
126+
127+
#undef WITH_WIFI // can't fit on partition
128+
#undef HAS_EXTERNAL_RTC
129+
#define HAS_EXTERNAL_RTC true
130+
#undef RTC_SDA
131+
#undef RTC_SCL
132+
#define RTC_SDA 41 // pin number
133+
#define RTC_SCL 40 // pin number
134+
135+
108136
#else
109137
// M5Stack Classic, Fire
110138
#undef HAS_EXTERNAL_RTC
@@ -241,13 +269,17 @@ static const int AMIGABALL_YPOS = 50;
241269

242270
#endif
243271

272+
273+
#define USE_SCREENSHOTS // load tft->snap() functions
244274
#include <ESP32-Chimera-Core.h> // https://github.com/tobozo/ESP32-Chimera-Core
245275

276+
246277
#if !defined ECC_VERSION_MAJOR || !defined ECC_VERSION_MAJOR || !defined ECC_VERSION_MAJOR
247278
#error "This app only uses ESP32-Chimera-Core >= 1.2.3"
248279
#else
249280
#if ((ECC_VERSION_MAJOR << 16) | (ECC_VERSION_MINOR << 8) | (ECC_VERSION_PATCH)) >= ((1 << 16) | (2 << 8) | (3))
250281
// yay, minimal version requirements are met !
282+
#define TFT_eSprite LGFX_Sprite // satisfy namespace requirements, comment this out if your version of chimera-core is too old
251283
#else
252284
#error "This app needs ESP32-Chimera-Core >= 1.2.3"
253285
#endif
@@ -265,11 +297,14 @@ static const int AMIGABALL_YPOS = 50;
265297
#define tft M5.Lcd // syntax sugar
266298
//#include "HID_XPad.h" // external HID
267299

300+
#pragma GCC diagnostic ignored "-Wunused-variable"
268301

269302
static TFT_eSprite gradientSprite( &tft ); // gradient background
270303
static TFT_eSprite heapGraphSprite( &tft ); // activity graph
271304
static TFT_eSprite hallOfMacSprite( &tft ); // mac address badge holder
272305

306+
307+
void tft_hScrollTo(uint16_t vsp);
273308
static bool isQuerying = false; // state maintained while SD is accessed, useful when SD is used instead of SD_MMC
274309
// TODO: make this SD-driver dependant rather than platform dependant
275310
static bool isInQuery()
@@ -285,7 +320,11 @@ static bool isInQuery()
285320
void tft_begin()
286321
{
287322

288-
M5.begin( true, true, false, false, false ); // don't start Serial
323+
#ifdef __M5STACKUPDATER_H
324+
M5.begin( true, false, false, false, false ); // don't start Serial and SD
325+
#else
326+
M5.begin( true, true, false, false, false ); // don't start Serial
327+
#endif
289328

290329
#if HAS_EXTERNAL_RTC
291330
Wire.begin(RTC_SDA, RTC_SCL);
@@ -294,16 +333,21 @@ void tft_begin()
294333
#endif
295334
delay( 100 );
296335
#ifdef __M5STACKUPDATER_H
336+
337+
tft_hScrollTo(0); // reset scroll position
338+
297339
if( hasHID() ) {
298340
// build has buttons => enable SD Updater at boot
299341
// New SD Updater support, requires the latest version of https://github.com/tobozo/M5Stack-SD-Updater/
342+
SDUCfg.display = &tft;
343+
300344
#if defined M5_SD_UPDATER_VERSION_INT
301-
SDUCfg.setLabelMenu("<< Menu");
302-
SDUCfg.setLabelSkip("Launch");
303-
SDUCfg.setAppName( PLATFORM_NAME " BLE Collector" );
304-
SDUCfg.setBinFileName( "/ESP32-BLECollector.bin" );
305-
//SDUCfg.useRolllback( false );
306-
checkSDUpdater( BLE_FS, MENU_BIN, 5000, TFCARD_CS_PIN ); // Filesystem, Launcher bin path, Wait delay, Sdcard CS pin
345+
// SDUCfg.setLabelMenu("<< Menu");
346+
// SDUCfg.setLabelSkip("Launch");
347+
// SDUCfg.setAppName( PLATFORM_NAME " BLE Collector" );
348+
// SDUCfg.setBinFileName( "/ESP32-BLECollector.bin" );
349+
// SDUCfg.useRolllback( false );
350+
checkSDUpdater( BLE_FS, MENU_BIN, 15000, TFCARD_CS_PIN ); // Filesystem, Launcher bin path, Wait delay, Sdcard CS pin
307351
#else
308352
checkSDUpdater();
309353
#endif

ESP32-BLECollector/NTP.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma GCC diagnostic ignored "-Wunused-variable"
2+
13
/*\
24
* NTP Helpers
35
\*/

ESP32-BLECollector/RTC.h

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
3636
*/
3737

38+
#pragma GCC diagnostic ignored "-Wunused-variable"
39+
3840
#if defined( ARDUINO_M5STACK_Core2 ) // M5Core2 uses BM8563
3941

4042
//#define BM8563_ADDR 0x51 // M5Core2 RTC I2C address

ESP32-BLECollector/SDUtils.h

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* SD Helpers
33
\*/
44

5+
6+
#pragma GCC diagnostic ignored "-Wunused-variable"
7+
58
static bool sd_mounted = false;
69

710

ESP32-BLECollector/ScrollPanel.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
3030
*/
3131

32+
#pragma GCC diagnostic ignored "-Wunused-variable"
33+
3234
#define SPACE " "
3335
static bool isScrolling = false;
3436
static bool isInScroll()

ESP32-BLECollector/TimeUtils.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
3030
*/
3131

32+
#pragma GCC diagnostic ignored "-Wunused-variable"
33+
3234
static unsigned long forcedUptime = 0;
3335

3436
enum TimeUpdateSources

ESP32-BLECollector/UI.h

+16-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
3030
*/
3131

32-
32+
#pragma GCC diagnostic ignored "-Wunused-variable"
3333

3434
char *macAddressToColorStr = new char[MAC_LEN+1];
3535

@@ -413,7 +413,7 @@ class UIUtils
413413
giveMuxSemaphore();
414414
}
415415

416-
416+
#if defined USE_SCREENSHOTS
417417
static void screenShot()
418418
{
419419
takeMuxSemaphore();
@@ -427,7 +427,8 @@ class UIUtils
427427

428428
//M5.ScreenShot->snapBMP("BLECollector", false);
429429
//M5.ScreenShot->snapJPG("BLECollector", false);
430-
M5.ScreenShot->snap("BLECollector", false); // filename prefix, show image after capture
430+
M5.ScreenShot->snapQOI("BLECollector", false);
431+
//M5.ScreenShot->snap("BLECollector", false); // filename prefix, show image after capture
431432

432433
// restore scroll states
433434
tft_scrollTo( yRef ); // restore software scroll
@@ -436,6 +437,7 @@ class UIUtils
436437
isQuerying = false;
437438
giveMuxSemaphore();
438439
}
440+
#endif
439441

440442
static void screenShow( void * fileName = NULL )
441443
{
@@ -455,8 +457,7 @@ class UIUtils
455457
giveMuxSemaphore();
456458
vTaskDelay( 5000 );
457459
}
458-
}
459-
if( String( (const char*)fileName ).endsWith(".bmp" ) ) {
460+
} else if( String( (const char*)fileName ).endsWith(".bmp" ) ) {
460461
if( !BLE_FS.exists( (const char*)fileName ) ) {
461462
log_e("File %s does not exist\n", (const char*)fileName );
462463
} else {
@@ -466,6 +467,16 @@ class UIUtils
466467
giveMuxSemaphore();
467468
vTaskDelay( 5000 );
468469
}
470+
} else if( String( (const char*)fileName ).endsWith(".qoi" ) ) {
471+
if( !BLE_FS.exists( (const char*)fileName ) ) {
472+
log_e("File %s does not exist\n", (const char*)fileName );
473+
} else {
474+
takeMuxSemaphore();
475+
Out.scrollNextPage(); // reset scroll position to zero otherwise image will have offset
476+
tft.drawQoiFile( BLE_FS, (const char*)fileName, 0, 0 );
477+
giveMuxSemaphore();
478+
vTaskDelay( 5000 );
479+
}
469480
}
470481
isQuerying = false;
471482
}

ESP32-BLECollector/UI_Icons.h

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
\*/
44

55

6+
#pragma GCC diagnostic ignored "-Wunused-variable"
7+
68
#include "Assets.h" // bitmaps
79

810

screenshots/capture-esp32-s3-box.jpg

121 KB
Loading

0 commit comments

Comments
 (0)