-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
123 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
#include <SPIFFS.h> | ||
#include <ESP32-targz.h> | ||
|
||
// progress callback, leave empty for less console output | ||
void myNullProgressCallback( uint8_t progress ) { | ||
// printf("Progress: %d", progress ); | ||
} | ||
// error/warning/info logger, leave empty for less console output | ||
void myNullLogger(const char* format, ...) { | ||
//va_list args; | ||
//va_start(args, format); | ||
//vprintf(format, args); | ||
//va_end(args); | ||
} | ||
|
||
|
||
void setup() { | ||
|
||
Serial.begin( 115200 ); | ||
Serial.printf("Initializing SPIFFS...\n"); | ||
|
||
SPIFFS.begin(true); | ||
|
||
// direct .tar.gz to file expanding is broken so do this separately | ||
// tarGzExpander(SPIFFS, "/tbz.tar.gz", SPIFFS, "/tmp"); | ||
if (!SPIFFS.begin(false)) { | ||
Serial.printf("SPIFFS Mount Failed\n"); | ||
} | ||
else { | ||
Serial.printf("SPIFFS Mount Successful\n"); | ||
} | ||
|
||
gzExpander(SPIFFS, "/tbz.tar.gz", SPIFFS, "/tmp/data.tar"); | ||
tarExpander(SPIFFS, "/tmp/data.tar", SPIFFS, "/tmp"); | ||
SPIFFS.remove("/tmp/data.tar"); | ||
//setProgressCallback( myNullProgressCallback ); | ||
//setLoggerCallback( myNullLogger ); | ||
|
||
tarGzListDir( SPIFFS, "/tmp"); | ||
if( tarGzExpander(SPIFFS, "/zombocom.tar.gz", SPIFFS, "/tmp") ) { | ||
Serial.println("Yay!"); | ||
tarGzListDir( SPIFFS, "/tmp" ); | ||
} else { | ||
Serial.printf("tarGzExpander failed with return code #%d\n", tarGzGetError() ); | ||
} | ||
|
||
} | ||
|
||
|
||
void loop() { | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,59 @@ | ||
#include <SPIFFS.h> | ||
#include <ESP32-targz.h> | ||
|
||
#define BUTTON_PIN 32 | ||
// progress callback, leave empty for less console output | ||
void myNullProgressCallback( uint8_t progress ) { | ||
// printf("Progress: %d", progress ); | ||
} | ||
// error/warning/info logger, leave empty for less console output | ||
void myNullLogger(const char* format, ...) { | ||
//va_list args; | ||
//va_start(args, format); | ||
//vprintf(format, args); | ||
//va_end(args); | ||
} | ||
|
||
void setup() { | ||
// 1) Find your firmware and gzip it: | ||
// gzip -c /tmp/arduino/firmware.bin > /tmp/firmware.gz | ||
// | ||
// 2) Copy the gz file in the /data folder and upload it using Arduino sketch data uploader for SPIFFS | ||
// | ||
// 3) Edit the value of "firmwareFile" to match the gz file name: | ||
// | ||
const char* firmwareFile = "/M5Rotatey_Cube.gz"; | ||
|
||
void setup() { | ||
Serial.begin( 115200 ); | ||
Serial.printf("Initializing SPIFFS...\n"); | ||
|
||
pinMode( BUTTON_PIN, INPUT_PULLUP ); | ||
|
||
if (!SPIFFS.begin(false)) { | ||
Serial.printf("SPIFFS Mount Failed\n"); | ||
} | ||
else { | ||
Serial.printf("SPIFFS Mount Successful\n"); | ||
} | ||
} | ||
|
||
void loop() { | ||
|
||
if( digitalRead( BUTTON_PIN ) == LOW ) { | ||
|
||
SPIFFS.begin(true); | ||
|
||
// flash the ESP with gz's contents (gzip the bin yourself and use the spiffs uploader) | ||
gzUpdater(SPIFFS, "/menu_bin.gz"); | ||
|
||
void loop() { | ||
bool done = false; | ||
|
||
while (!done) { | ||
delay(1000); | ||
if (SPIFFS.exists( firmwareFile )) { // <<< gzipped firmware update | ||
Serial.printf("Found file, about to update...\n"); | ||
delay(1000); | ||
//setProgressCallback( myNullProgressCallback ); | ||
//setLoggerCallback( myNullLogger ); | ||
// flash the ESP with gz's contents (gzip the bin yourself and use the spiffs uploader) | ||
if( ! gzUpdater(SPIFFS, firmwareFile ) ) { | ||
Serial.printf("gzUpdater failed with return code #%d", tarGzGetError() ); | ||
} | ||
done = true; | ||
} | ||
else { | ||
Serial.printf("firmware not found\n"); | ||
break; | ||
} | ||
} | ||
|
||
} |
Binary file not shown.