Skip to content

Commit

Permalink
Merge pull request #182 from tobozo/1.2.7
Browse files Browse the repository at this point in the history
1.2.7
  • Loading branch information
tobozo authored May 23, 2023
2 parents 62170f8 + 73e506b commit 84eef98
Show file tree
Hide file tree
Showing 37 changed files with 1,151 additions and 408 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ArduinoBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ jobs:
#- 2.0.3
#- 2.0.4
#- 2.0.5
- 2.0.6
#- 2.0.6
- 2.0.7
- 2.0.8
- 2.0.9

matrix-context:
- M5Core2-test
Expand Down Expand Up @@ -65,9 +66,10 @@ jobs:
#- sdk-version: 2.0.0
#- sdk-version: 2.0.1
#- sdk-version: 2.0.5
- sdk-version: 2.0.6
#- sdk-version: 2.0.6
- sdk-version: 2.0.7
- sdk-version: 2.0.8
- sdk-version: 2.0.9

# library health test sketches
- { matrix-context: M5Core2-test, arduino-board: m5stack-core2, sketch-names: M5Core2-SDLoader-Snippet.ino, required-libraries: "M5Core2", ... }
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/PlatformioBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
- m5unified
- s3box
- m5stack-atom
- m5stack-cores3
- sdfat-test

platform-version:
#- 1.0.6
Expand All @@ -45,9 +47,10 @@ jobs:
#- 2.0.3
#- 2.0.4
#- 2.0.5
- 2.0.6
#- 2.0.6
- 2.0.7
- 2.0.8
- 2.0.9

#exclude:
#- { piocontext: s3box, platform-version: 1.0.6 }
Expand All @@ -64,7 +67,7 @@ jobs:
- piocontext: m5stack-core2
- piocontext: m5unified
- piocontext: s3box
- { platform-version: 2.0.8, piocontext: sdfat-test }
- piocontext: sdfat-test

fail-fast: false

Expand Down Expand Up @@ -101,7 +104,9 @@ jobs:
- name: Run PlatformIO
run: |
cd ${{ env.PROJECT_DIR }}
export pio_ver=${{ matrix.platform-version }}
export pio_env="${pio_ver//./_}"
[[ "${{ env.BRANCH_NAME }}" == "master" ]] && rm dev_lib_deps.ini || echo "Develop!" && pio system prune -f
pio pkg install -e ${{ matrix.piocontext }}@${{ matrix.platform-version }} --no-save --library file://$(realpath ../../../)
pio run -e ${{ matrix.piocontext }}@${{ matrix.platform-version }}
pio pkg install -e ${{ matrix.piocontext }}-$pio_env --no-save --library file://$(realpath ../../../)
pio run -e ${{ matrix.piocontext }}-$pio_env
10 changes: 4 additions & 6 deletions examples/Headless/Headless.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define SDU_APP_NAME "Headless Example"
#define SDU_APP_PATH "/Headless_Example.bin"
#define SDU_NO_AUTODETECT // don't load gfx clutter (but implement my own action trigger)
#define TFCARD_CS_PIN 4 // this is needed by SD.begin()
#include <SD.h> // /!\ headless mode skips autodetect and may require to include the filesystem library **before** the M5StackUpdater library
#include <ESP32-targz.h> // optional: https://github.com/tobozo/ESP32-targz
#define SDU_NO_PRAGMAS // don't print pragma messages when compiling
#define TFCARD_CS_PIN 4 // this is needed by SD.begin()
#include <SD.h> // /!\ headless mode skips autodetect and may require to include the filesystem library **before** the M5StackUpdater library
#include <ESP32-targz.h> // optional: https://github.com/tobozo/ESP32-targz
#include <M5StackUpdater.h>


Expand Down Expand Up @@ -40,12 +41,9 @@ void setup()
);

Serial.println("Starting application");


}

void loop()
{


}
Binary file added examples/M5Stack-SD-Menu/bootloader-tinyuf2.bin
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/M5Stack-SD-Menu/certificates.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#pragma once

#if defined USE_DOWNLOADER

/*
ssl_host="phpsecure.info" && \
Expand Down Expand Up @@ -166,3 +170,5 @@ const char* phpsecu_re_ca =\
"KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n"\
"-----END CERTIFICATE-----\n"\
"";

#endif
6 changes: 3 additions & 3 deletions examples/M5Stack-SD-Menu/controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ unsigned long beforeRepeatDelay = LONG_DELAY_BEFORE_REPEAT;
bool JOY_X_pressed = false;
#endif

#if defined ARDUINO_M5Stack_Core_ESP32 || defined ARDUINO_M5STACK_FIRE
#if !defined __M5UNIFIED_HPP__ && (defined ARDUINO_M5Stack_Core_ESP32 || ARDUINO_M5STACK_CORE_ESP32 || defined ARDUINO_M5STACK_FIRE)
#define CAN_I_HAZ_M5FACES
#endif


#if defined ARDUINO_M5STACK_Core2
#if defined ARDUINO_M5STACK_Core2 && defined _CHIMERA_CORE_
// enable M5Core2's haptic feedback !
static bool isVibrating = false;

Expand Down Expand Up @@ -295,7 +295,7 @@ HIDSignal getControls()
}
}

#if defined ARDUINO_M5Stack_Core_ESP32 || defined ARDUINO_M5STACK_FIRE || defined ARDUINO_M5STACK_Core2 || defined ARDUINO_ESP32_S3_BOX
#if defined ARDUINO_M5Stack_Core_ESP32 || defined ARDUINO_M5STACK_FIRE || defined ARDUINO_M5STACK_Core2 || defined ARDUINO_ESP32_S3_BOX || defined ARDUINO_M5STACK_CORES3

M5.update();

Expand Down
34 changes: 30 additions & 4 deletions examples/M5Stack-SD-Menu/core.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
#pragma once

//#include <FFat.h>
#include <SD.h>

#define ECC_NO_PRAGMAS // turn ESP32-Chimera-Core's pragma messages off
#define ECC_NO_SCREENSHOT // comment this out to take screenshots
#define ECC_NO_SPEAKER // comment this out to use audio
#define ECC_NO_NVSUTILS
#define ECC_NO_POWER
#define ECC_NO_MPU
#define ECC_NO_RTC
#include <ESP32-Chimera-Core.h> // use LGFX display autodetect
#include <ESP32-targz.h> // optional: https://github.com/tobozo/ESP32-targz

//#include <M5Unified.h>

#include <ESP32-targz.h> // optional: https://github.com/tobozo/ESP32-targz
#define SDU_NO_PRAGMAS // turn M5StackUpdater's pragma messages off
#define SDU_APP_NAME "Application Launcher"
#include <M5StackUpdater.h> // https://github.com/tobozo/M5Stack-SD-Updater

#if defined(ARDUINO_M5STACK_ATOM_AND_TFCARD)

#if defined _CLK && defined _MISO && defined _MOSI
#if !defined SDU_SPI_MODE
#define SDU_SPI_MODE SPI_MODE3
#endif
#if !defined SDU_SPI_FREQ
#define SDU_SPI_FREQ 80000000
#endif
#define SDU_SD_BEGIN [](int csPin)->bool{ SPI.begin(_CLK, _MISO, _MOSI, csPin); SPI.setDataMode(SDU_SPI_MODE); return SD.begin(csPin, SPI, SDU_SPI_FREQ); }
#endif

class LGFX_8BIT_CVBS : public lgfx::LGFX_Device
{
public:
Expand Down Expand Up @@ -40,14 +61,19 @@

static LGFX_8BIT_CVBS tft;

#elif defined __M5UNIFIED_HPP__

M5GFX &tft( M5.Lcd );

#else

M5Display &tft( M5.Lcd );

#endif

#include <M5StackUpdater.h> // https://github.com/tobozo/M5Stack-SD-Updater

static LGFX_Sprite sprite = LGFX_Sprite( &tft );
static SDU_Sprite sprite = SDU_Sprite( &tft );
fs::SDFS &M5_FS(SD);

void progressBar( LGFX* tft, int x, int y, int w, int h, uint8_t val, uint16_t color = 0x09F1, uint16_t bgcolor = 0x0000 );
void progressBar( SDU_DISPLAY_TYPE tft, int x, int y, int w, int h, uint8_t val, uint16_t color = 0x09F1, uint16_t bgcolor = 0x0000 );
5 changes: 5 additions & 0 deletions examples/M5Stack-SD-Menu/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

void setup()
{

#if defined __M5UNIFIED_HPP__
M5.Log.setEnableColor(m5::log_target_serial, false);
#endif

#ifdef ARDUINO_M5STACK_FIRE
spicommon_periph_free( VSPI_HOST ); // fix 2.0.4 psramInit mess
#endif
Expand Down
54 changes: 34 additions & 20 deletions examples/M5Stack-SD-Menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,43 @@
// TODO: moved USE_DOWNLOADER features to "AppStore.ino"
// auto-select board
#if defined( ARDUINO_M5STACK_Core2 )
#warning M5STACK Core2 DETECTED !!
#pragma message "M5STACK Core2 detected"
#define PLATFORM_NAME "M5Core2"
#define DEFAULT_REGISTRY_BOARD "m5core2"
//#define USE_DOWNLOADER
#elif defined( ARDUINO_M5Stack_Core_ESP32 )
#warning M5STACK CLASSIC DETECTED !!
#pragma message "M5STACK CLASSIC detected"
#define PLATFORM_NAME "M5Stack"
#define DEFAULT_REGISTRY_BOARD "m5stack"
//#define USE_DOWNLOADER // moved to AppStore.ino
#elif defined( ARDUINO_M5STACK_FIRE )
#warning M5STACK FIRE DETECTED !!
#pragma message "M5STACK FIRE detected"
#define PLATFORM_NAME "M5Fire"
#define DEFAULT_REGISTRY_BOARD "m5fire"
//#define USE_DOWNLOADER
#elif defined( ARDUINO_ODROID_ESP32 )
#warning ODROID DETECTED !!
#pragma message "ODROID detected"
#define PLATFORM_NAME "Odroid-GO"
#define DEFAULT_REGISTRY_BOARD "odroid"
#elif defined ( ARDUINO_ESP32_DEV ) || defined( ARDUINO_LOLIN_D32_PRO )
#warning WROVER OR LOLIN_D32_PRO DETECTED !!
#pragma message "WROVER OR LOLIN_D32_PRO detected"
#define DEFAULT_REGISTRY_BOARD "esp32"
#define PLATFORM_NAME "ESP32"
//#define USE_DOWNLOADER
#elif defined( ARDUINO_ESP32_S3_BOX )
#warning ESP32_S3_BOX DETECTED !!
#pragma message "ESP32_S3_BOX detected"
#define DEFAULT_REGISTRY_BOARD "esp32s3"
#define PLATFORM_NAME "S3Box"
#elif defined ARDUINO_M5STACK_CORES3
#pragma message "M5Sack CoreS3 detected"
#define DEFAULT_REGISTRY_BOARD "cores3"
#define PLATFORM_NAME "CoreS3"
#elif defined( ARDUINO_M5STACK_ATOM_AND_TFCARD )
#warning M5Stack ATOM DETECTED !!
#pragma message "M5Stack ATOM detected"
#define DEFAULT_REGISTRY_BOARD "m5atom"
#define PLATFORM_NAME "M5 ATOM(matrix/lite)"
#else
#warning NOTHING DETECTED !!
#pragma message "NOTHING detected"
#define DEFAULT_REGISTRY_BOARD "lambda"
#define PLATFORM_NAME "LAMBDA"
#endif
Expand Down Expand Up @@ -117,7 +121,7 @@
#include "compile_time.h"
//#include <SPIFFS.h>

#if defined(_CHIMERA_CORE_) || defined(ARDUINO_M5STACK_ATOM_AND_TFCARD)
#if defined(_CHIMERA_CORE_) || defined(ARDUINO_M5STACK_ATOM_AND_TFCARD) || __has_include("lgfx/utility/lgfx_qrcode.h")
#include "lgfx/utility/lgfx_qrcode.h"
#define qrcode_getBufferSize lgfx_qrcode_getBufferSize
#define qrcode_initText lgfx_qrcode_initText
Expand Down Expand Up @@ -179,9 +183,9 @@ void freeMeta();
void renderIcon( FileInfo &fileInfo );
void renderMeta( JSONMeta &jsonMeta );
//void qrRender( String text, float sizeinpixels, int xOffset=-1, int yOffset=-1 );
void qrRender( LGFX* gfx, String text, int posX, int posY, uint32_t width, uint32_t height );
void qrRender( SDU_DISPLAY_TYPE gfx, String text, int posX, int posY, uint32_t width, uint32_t height );

void progressBar(LGFX* tft, int x, int y, int w, int h, uint8_t val, uint16_t color, uint16_t bgcolor)
void progressBar(SDU_DISPLAY_TYPE tft, int x, int y, int w, int h, uint8_t val, uint16_t color, uint16_t bgcolor)
{
tft->drawRect(x, y, w, h, color);
if (val > 100) val = 100;
Expand Down Expand Up @@ -351,12 +355,12 @@ void renderMeta( JSONMeta &jsonMeta )
sprite.print( jsonMeta.authorName );
sprite.println( AUTHOR_SUFFIX );
sprite.println();
qrRender( (LGFX*)&tft, jsonMeta.projectURL, 155, 45, 150, 150 );
qrRender( SDU_DISPLAY_OBJ_PTR, jsonMeta.projectURL, 155, 45, 150, 150 );
} else if( jsonMeta.projectURL!="" ) { // only projectURL
log_d("Rendering QRCode");
sprite.println( jsonMeta.projectURL );
sprite.println();
qrRender( (LGFX*)&tft, jsonMeta.projectURL, 155, 45, 150, 150 );
qrRender( SDU_DISPLAY_OBJ_PTR, jsonMeta.projectURL, 155, 45, 150, 150 );
} else { // only authorName
log_d("Rendering Authorname");
sprite.println( jsonMeta.authorName );
Expand Down Expand Up @@ -394,7 +398,7 @@ uint8_t getLowestQRVersionFromString( String text, uint8_t ecc )
}


void qrRender( LGFX* gfx, String text, int posX, int posY, uint32_t width, uint32_t height )
void qrRender( SDU_DISPLAY_TYPE gfx, String text, int posX, int posY, uint32_t width, uint32_t height )
{
// see https://github.com/Kongduino/M5_QR_Code/blob/master/M5_QRCode_Test.ino
// Create the QR code
Expand Down Expand Up @@ -460,7 +464,7 @@ void listDir( fs::FS &fs, const char * dirName, uint8_t levels, bool process )
getFileInfo( fileInfo[appsCount], &file );
if( appsCountProgress > 0 ) {
float progressRatio = ((((float)appsCount+1.0) / (float)appsCountProgress) * 80.00)+20.00;
progressBar( (LGFX*)&tft, 110, 112, 100, 20, progressRatio);
progressBar( SDU_DISPLAY_OBJ_PTR, 110, 112, 100, 20, progressRatio);
tft.fillRect( 0, 140, tft.width(), 16, TFT_BLACK);
tft.drawString( fileInfo[appsCount].displayName(), 160, 148, 2);
}
Expand Down Expand Up @@ -488,7 +492,7 @@ void listDir( fs::FS &fs, const char * dirName, uint8_t levels, bool process )
getFileInfo( fileInfo[appsCount], &file );
if( appsCountProgress > 0 ) {
float progressRatio = ((((float)appsCount+1.0) / (float)appsCountProgress) * 80.00)+20.00;
progressBar( (LGFX*)&tft, 110, 112, 100, 20, progressRatio);
progressBar( SDU_DISPLAY_OBJ_PTR, 110, 112, 100, 20, progressRatio);
tft.fillRect( 0, 140, tft.width(), 16, TFT_BLACK);
tft.drawString( fileInfo[appsCount].displayName(), 160, 148, 2);
}
Expand Down Expand Up @@ -829,6 +833,8 @@ void UISetup()

heapState();

//lsPart();

tft.setBrightness(100);
lastcheck = millis();
tft.drawJpg(disk01_jpg, 1775, (tft.width()-30)/2, 100);
Expand All @@ -843,7 +849,7 @@ void UISetup()
#ifdef _CHIMERA_CORE_
while( !M5.sd_begin() )
#else
while( !M5_FS.begin() )
while( !M5_FS.begin(4) )
#endif
{
// TODO: make a more fancy animation
Expand Down Expand Up @@ -912,6 +918,14 @@ void UISetup()
gotoSleep();
}
#endif

//Serial.println("Going to factory in 5s");
//delay(5000);
//loadFactory();
//ESP.restart();



}


Expand All @@ -927,7 +941,7 @@ void doFSChecks()
checkMenuStickyPartition();

tft.fillRect(110, 112, 100, 20,0);
progressBar( (LGFX*)&tft, 110, 112, 100, 20, 10);
progressBar( SDU_DISPLAY_OBJ_PTR, 110, 112, 100, 20, 10);

scanDataFolder(); // do SD / SPIFFS health checks

Expand Down Expand Up @@ -957,7 +971,7 @@ void doFSInventory()
tft.setTextColor( TFT_WHITE );
tft.setTextSize( 1 );
tft.clear();
progressBar( (LGFX*)&tft, 110, 112, 100, 20, 20);
progressBar( SDU_DISPLAY_OBJ_PTR, 110, 112, 100, 20, 20);
appsCount = 0;
listDir(M5_FS, "/", 0, false); // count valid files first so a progress meter can be displayed
appsCountProgress = appsCount;
Expand Down Expand Up @@ -987,7 +1001,7 @@ void HIDMenuObserve() {
tft.setBrightness( brightness );
}
switch( hidState ) {
#ifdef _CHIMERA_CORE_
#if defined _CHIMERA_CORE_ && defined USE_SCREENSHOTS
case HID_SCREENSHOT:
M5.ScreenShot->snap( "screenshot" );
break;
Expand Down
Loading

0 comments on commit 84eef98

Please sign in to comment.