Skip to content

Commit 3fea101

Browse files
Kevintjebme-no-dev
authored andcommitted
Changed update example to use different controlflow structure (espressif#711)
1 parent de408d0 commit 3fea101

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: libraries/Update/examples/SD_Update/SD_Update.ino

+11-11
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,25 @@ void setup() {
8888

8989
//first init and check SD card
9090
if (!SD_MMC.begin()) {
91-
Serial.println("Card Mount Failed");
92-
goto end;
91+
rebootEspWithReason("Card Mount Failed");
9392
}
9493

9594
cardType = SD_MMC.cardType();
9695

9796
if (cardType == CARD_NONE) {
98-
Serial.println("No SD_MMC card attached");
99-
goto end;
100-
}
101-
102-
updateFromFS(SD_MMC);
97+
rebootEspWithReason("No SD_MMC card attached");
98+
}else{
99+
updateFromFS(SD_MMC);
100+
}
101+
}
103102

104-
end:
105-
delay(1000);
106-
ESP.restart();
103+
void rebootEspWithReason(String reason){
104+
Serial.println(reason);
105+
delay(1000);
106+
ESP.restart();
107107
}
108108

109109
//will not be reached
110110
void loop() {
111111

112-
}
112+
}

0 commit comments

Comments
 (0)