Skip to content

Commit

Permalink
Allow to retrieve the error code from the nina module that happend du…
Browse files Browse the repository at this point in the history
…ring OTA download:

  typedef enum OTA_Error {
    ERR_NO_ERROR = 0,
    ERR_OPEN     = 1,
    ERR_LENGTH   = 2,
    ERR_CRC      = 3,
    ERR_RENAME   = 4,
  };
  • Loading branch information
aentinger committed Aug 6, 2020
1 parent 2c4518c commit ee28a21
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/WiFiStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ class WiFiStorageClass
WiFiDrv::downloadFile(url, strlen(url), filename, strlen(filename));
return true;
}
static bool downloadOTA(const char * url) {
return (WiFiDrv::downloadOTA(url, strlen(url)) == 0);
static bool downloadOTA(const char * url, uint8_t * res_ota_download = NULL) {
uint8_t const res = WiFiDrv::downloadOTA(url, strlen(url));
if (res_ota_download)
*res_ota_download = res;
bool const success = (res == 0);
return success;
}


Expand All @@ -78,8 +82,8 @@ class WiFiStorageClass
static bool download(String url, String filename) {
return download(url.c_str(), filename.c_str());
}
static bool download(String url) {
return downloadOTA(url.c_str());
static bool download(String url, uint8_t * res_ota_download = NULL) {
return downloadOTA(url.c_str(), res_ota_download);
}
};

Expand Down

0 comments on commit ee28a21

Please sign in to comment.