Skip to content

Commit

Permalink
Merge pull request #158 from tobozo/1.1.3
Browse files Browse the repository at this point in the history
1.1.3
  • Loading branch information
tobozo authored Sep 29, 2021
2 parents 76293e6 + 66ec6a7 commit 1f70651
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": "https://github.com/tobozo/M5Stack-SD-Updater.git"
},
"version": "1.1.2",
"version": "1.1.3",
"framework": "arduino",
"platforms": "espressif32"
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=M5Stack-SD-Updater
version=1.1.2
version=1.1.3
author=tobozo
maintainer[email protected]
sentence=SD Card Loader for M5 Stack
Expand Down
3 changes: 1 addition & 2 deletions src/M5StackUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#endif



void SDUpdater::_error( const String& errMsg, unsigned long waitdelay )
{
Serial.print("[ERROR] ");
Expand Down Expand Up @@ -444,7 +443,7 @@ void SDUpdater::checkSDUpdaterUI( String fileName, unsigned long waitdelay )
}

if( cfg->onWaitForAction ) {
if ( cfg->onWaitForAction( isRollBack ? (char*)ROLLBACK_LABEL : (char*)LAUNCHER_LABEL, (char*)SKIP_LABEL, waitdelay ) == 1 ) {
if ( cfg->onWaitForAction( isRollBack ? (char*)cfg->labelRollback : (char*)cfg->labelMenu, (char*)cfg->labelSkip, waitdelay ) == 1 ) {
if( isRollBack == false ) {
Serial.printf( SDU_LOAD_TPL, fileName.c_str() );
updateFromFS( fileName );
Expand Down
22 changes: 16 additions & 6 deletions src/M5StackUpdaterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
*
*/


#define ROLLBACK_LABEL "Rollback" // reload app from the "other" OTA partition
#define LAUNCHER_LABEL "Launcher" // load Launcher (typically menu.bin)
#define SKIP_LABEL "Skip >>|" // resume normal operations (=no action taken)
#define BTN_HINT_MSG "SD-Updater Options"
#define SDU_LOAD_TPL "Will Load menu binary : %s\n"
#define SDU_ROLLBACK_MSG "Will Roll back"


// callback signatures
typedef void (*onProgressCb)( int state, int size );
typedef void (*onMessageCb)( const String& label );
Expand All @@ -45,6 +54,9 @@ struct config_sdu_t
fs::FS *fs = nullptr;
int TFCardCsPin = -1;
bool load_defaults = true;
const char* labelMenu = LAUNCHER_LABEL;
const char* labelSkip = SKIP_LABEL;
const char* labelRollback = ROLLBACK_LABEL;

onProgressCb onProgress = nullptr;
onMessageCb onMessage = nullptr;
Expand All @@ -66,6 +78,10 @@ struct config_sdu_t
void setButtonDrawCb( onButtonDrawCb cb ) { onButtonDraw = cb; }
void setWaitForActionCb( onWaitForActionCb cb ) { onWaitForAction = cb; }

void setLabelMenu( const char* label ) { labelMenu = label; }
void setLabelSkip( const char* label ) { labelSkip = label; }
void setLabelRollback( const char* label ) { labelRollback = label; }

};

// override this from sketch
Expand Down Expand Up @@ -98,12 +114,6 @@ extern "C" {
// required to store the MENU_BIN hash
#include <Preferences.h>

#define ROLLBACK_LABEL "Rollback" // reload app from the "other" OTA partition
#define LAUNCHER_LABEL "Launcher" // load Launcher (typically menu.bin)
#define SKIP_LABEL "Skip >>|" // resume normal operations (=no action taken)
#define BTN_HINT_MSG "SD-Updater Options"
#define SDU_LOAD_TPL "Will Load menu binary : %s\n"
#define SDU_ROLLBACK_MSG "Will Roll back"

#ifndef MENU_BIN
#define MENU_BIN "/menu.bin"
Expand Down
2 changes: 1 addition & 1 deletion src/M5StackUpdaterUITouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

void pushIcon(const char* label)
{
if( strcmp( label, LAUNCHER_LABEL ) == 0 || strcmp( label, ROLLBACK_LABEL ) == 0 )
if( strcmp( label, SDUCfg.labelMenu ) == 0 || strcmp( label, SDUCfg.labelRollback ) == 0 )
{
TouchStyles bs;
auto IconSprite = TFT_eSprite( &SDU_GFX );
Expand Down
7 changes: 6 additions & 1 deletion src/gitTagVersion.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#define SDU_VERSION_MAJOR 1
#define SDU_VERSION_MINOR 1
#define SDU_VERSION_PATCH 2
#define SDU_VERSION_PATCH 3
#define _SDU_STR(x) #x
#define SDU_STR(x) _SDU_STR(x)
// Macro to convert library version number into an integer
#define VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
// current library version as a string
#define M5_SD_UPDATER_VERSION SDU_STR(SDU_VERSION_MAJOR) "." SDU_STR(SDU_VERSION_MINOR) "." SDU_STR(SDU_VERSION_PATCH)
// current library version as an int, to be used in comparisons, such as M5_SD_UPDATER_VERSION_INT >= VERSION_VAL(2, 0, 0)
#define M5_SD_UPDATER_VERSION_INT VERSION_VAL(SDU_VERSION_MAJOR, SDU_VERSION_MINOR, SDU_VERSION_PATCH)

0 comments on commit 1f70651

Please sign in to comment.