From bb45942c75a1c5232d90dc8bd2f981261f11bcc0 Mon Sep 17 00:00:00 2001 From: Kevin van den Broek Date: Mon, 9 Oct 2017 13:22:51 +0200 Subject: [PATCH] Changed update example to use different controlflow structure --- .../Update/examples/SD_Update/SD_Update.ino | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libraries/Update/examples/SD_Update/SD_Update.ino b/libraries/Update/examples/SD_Update/SD_Update.ino index 2a8e879feca..9f3f494aba8 100644 --- a/libraries/Update/examples/SD_Update/SD_Update.ino +++ b/libraries/Update/examples/SD_Update/SD_Update.ino @@ -88,25 +88,25 @@ void setup() { //first init and check SD card if (!SD_MMC.begin()) { - Serial.println("Card Mount Failed"); - goto end; + rebootEspWithReason("Card Mount Failed"); } cardType = SD_MMC.cardType(); if (cardType == CARD_NONE) { - Serial.println("No SD_MMC card attached"); - goto end; - } - - updateFromFS(SD_MMC); + rebootEspWithReason("No SD_MMC card attached"); + }else{ + updateFromFS(SD_MMC); + } +} -end: - delay(1000); - ESP.restart(); +void rebootEspWithReason(String reason){ + Serial.println(reason); + delay(1000); + ESP.restart(); } //will not be reached void loop() { -} +} \ No newline at end of file