Skip to content

Enhance message about absent WiFi firmware #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions libraries/WiFi/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ unsigned long arduino::WiFiClass::getTime() {
#include "MBRBlockDevice.h"
#include "FATFileSystem.h"

#define WIFI_FIRMWARE_PATH "/wlan/4343WA1.BIN"

QSPIFBlockDevice root(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
mbed::MBRBlockDevice wifi_data(&root, 1);
mbed::FATFileSystem wifi_data_fs("wlan");
Expand All @@ -292,7 +294,9 @@ extern "C" bool wiced_filesystem_mount() {
mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024);
int err = wifi_data_fs.mount(&wifi_data);
if (err) {
Serial.println("Failed to mount filesystem");
Serial.println("Failed to mount the filesystem containing the WiFi firmware.");
Serial.println("Usually that means that the WiFi firmware has not been installed yet"
" or was overwritten with another firmware.");
goto error;
}

Expand All @@ -302,7 +306,7 @@ extern "C" bool wiced_filesystem_mount() {
/* print all the files and directories within directory */
while ((ent = readdir(dir)) != NULL) {
String fullname = "/wlan/" + String(ent->d_name);
if (fullname == "/wlan/4343WA1.BIN") {
if (fullname == WIFI_FIRMWARE_PATH) {
closedir(dir);
firmware_available = true;
return true;
Expand All @@ -312,7 +316,7 @@ extern "C" bool wiced_filesystem_mount() {
closedir(dir);
}
error:
Serial.println("Please run \"PortentaWiFiFirmwareUpdater\" sketch once");
Serial.println("Please run the \"PortentaWiFiFirmwareUpdater\" sketch once to install the WiFi firmware.");
whd_print_logbuffer();
while (1) {}
return false;
Expand Down