Update SD_Update.ino

This commit is contained in:
me-no-dev
2020-05-12 02:01:04 +03:00
parent 2fcb386dcf
commit d64a825b0a

View File

@ -9,14 +9,14 @@
2. Copy update.bin to a SD-Card, you can basically 2. Copy update.bin to a SD-Card, you can basically
compile this or any other example compile this or any other example
then copy and rename the app binary to the sd card root then copy and rename the app binary to the sd card root
3. Connect SD-Card as shown in SD_MMC example, 3. Connect SD-Card as shown in SD example,
this can also be adapted for SPI this can also be adapted for SPI
3. After successfull update and reboot, ESP32 shall start the new app 3. After successfull update and reboot, ESP32 shall start the new app
*/ */
#include <Update.h> #include <Update.h>
#include <FS.h> #include <FS.h>
#include <SD_MMC.h> #include <SD.h>
// perform the actual update from a given stream // perform the actual update from a given stream
void performUpdate(Stream &updateSource, size_t updateSize) { void performUpdate(Stream &updateSource, size_t updateSize) {
@ -87,16 +87,16 @@ void setup() {
// Serial.println("Update successfull"); // Serial.println("Update successfull");
//first init and check SD card //first init and check SD card
if (!SD_MMC.begin()) { if (!SD.begin()) {
rebootEspWithReason("Card Mount Failed"); rebootEspWithReason("Card Mount Failed");
} }
cardType = SD_MMC.cardType(); cardType = SD.cardType();
if (cardType == CARD_NONE) { if (cardType == CARD_NONE) {
rebootEspWithReason("No SD_MMC card attached"); rebootEspWithReason("No SD_MMC card attached");
}else{ }else{
updateFromFS(SD_MMC); updateFromFS(SD);
} }
} }