Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ String BruceConfig::getWifiPassword(const String &ssid) const {
return "";
}

bool BruceConfig::hasWifiCredential(const String &ssid) const { return wifi.find(ssid) != wifi.end(); }

void BruceConfig::addEvilWifiName(String value) {
evilWifiNames.insert(value);
saveFile();
Expand Down
1 change: 1 addition & 0 deletions src/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class BruceConfig : public BruceTheme {
void addQrCodeEntry(const String &menuName, const String &content);
void removeQrCodeEntry(const String &menuName);
String getWifiPassword(const String &ssid) const;
bool hasWifiCredential(const String &ssid) const;
void addEvilWifiName(String value);
void removeEvilWifiName(String value);
void setEvilEndpointCreds(String value);
Expand Down
5 changes: 4 additions & 1 deletion src/core/wifi/wifi_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ void wifiConnectTask(void *pvParameters) {
for (int i = 0; i < nets; i++) {
ssid = WiFi.SSID(i);
pwd = bruceConfig.getWifiPassword(ssid);
if (pwd == "") continue;
// An empty password only means "unknown network" for secured APs: known open
// networks are stored with an empty password and must be joined without one.
bool knownOpenNet = WiFi.encryptionType(i) == WIFI_AUTH_OPEN && bruceConfig.hasWifiCredential(ssid);
if (pwd == "" && !knownOpenNet) continue;

WiFi.begin(ssid, pwd);
for (int i = 0; i < 50; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/wifi/wifi_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ esp_err_t wifiRawTx(wifi_interface_t ifx, const void *frame, int len, uint8_t re
/**
* @brief tries to connect to min(found_networks, maxSearch) networks
* using stored passwords
* @TODO fix: rn it skips open networks due to password == "" check
* @note known open networks are stored with an empty password and joined without one
*/
void wifiConnectTask(void *pvParameters);

Expand Down