Skip to content

Commit dc6d0c5

Browse files
committed
WiFi.firmwareVersion: try to mount wifi fs only if needed
1 parent 931f0bb commit dc6d0c5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

libraries/WiFi/src/WiFi.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,17 @@ wiced_result_t whd_firmware_check_hook(const char* mounted_name, int mount_err)
366366

367367
#include "whd_version.h"
368368
const char* arduino::WiFiClass::firmwareVersion() {
369-
if ((wiced_filesystem_init() != WICED_ERROR) && (wiced_filesystem_mount_default() != WICED_ERROR)) {
370-
if (firmware_available) {
371-
return WHD_VERSION;
372-
}
369+
if (!firmware_available) {
370+
/* Try to mount WiFi firmware filesystem */
371+
wiced_filesystem_init();
372+
wiced_filesystem_mount_default();
373+
}
374+
375+
if (firmware_available) {
376+
return WHD_VERSION;
377+
} else {
378+
return "v0.0.0";
373379
}
374-
return "v0.0.0";
375380
}
376381

377382
arduino::WiFiClass WiFi(WiFiInterface::get_default_instance());

0 commit comments

Comments
 (0)