Skip to content

Commit 2dceec3

Browse files
committed
WIFI_HIDE_SSID
1 parent acdc7c9 commit 2dceec3

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

WifiESP32.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,16 @@ bool WifiESP::setup(const char *SSid,
277277
#else
278278
WiFi.setSleep(false);
279279
#endif
280+
281+
#ifdef WIFI_HIDE_SSID
282+
const bool hiddenAP = true;
283+
#else
284+
const bool hiddenAP = false;
285+
#endif
286+
280287
if (WiFi.softAP(strSSID.c_str(),
281288
havePassword ? password : strPass.c_str(),
282-
channel, false, 8)) {
289+
channel, hiddenAP, 8)) {
283290
// DIAG(F("Wifi AP SSID %s PASS %s"),strSSID.c_str(),havePassword ? password : strPass.c_str());
284291
DIAG(F("Wifi in AP mode"));
285292
LCD(5, F("Wifi: %s"), strSSID.c_str());

WifiInterface.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,20 +309,26 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password,
309309
checkForOK(1000, true, false); // suck up remainder of AT+CIFSR
310310

311311
i=0;
312+
#ifdef WIFI_HIDE_SSID
313+
const byte hiddenAP = true;
314+
#else
315+
const bool hiddenAP = false;
316+
#endif
317+
312318
do {
313319
if (!forceAP) {
314320
if (STRNCMP_P(yourNetwork, (const char*)password, 13) == 0) {
315321
// unconfigured
316-
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"DCCEX_%s\",\"PASS_%s\",%d,4\r\n"),
317-
oldCmd ? "" : "_CUR", macTail, macTail, channel);
322+
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"DCCEX_%s\",\"PASS_%s\",%d,4,4,%b\r\n"),
323+
oldCmd ? "" : "_CUR", macTail, macTail, channel,hiddenAP);
318324
} else {
319325
// password configured by user
320-
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"DCCEX_%s\",\"%S\",%d,4\r\n"), oldCmd ? "" : "_CUR",
321-
macTail, password, channel);
326+
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"DCCEX_%s\",\"%S\",%d,4,4,%b\r\n"), oldCmd ? "" : "_CUR",
327+
macTail, password, channel,hiddenAP);
322328
}
323329
} else {
324-
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"%S\",\"%S\",%d,4\r\n"),
325-
oldCmd ? "" : "_CUR", SSid, password, channel);
330+
StringFormatter::send(wifiStream, F("AT+CWSAP%s=\"%S\",\"%S\",%d,4,4,%b\r\n"),
331+
oldCmd ? "" : "_CUR", SSid, password, channel,hiddenAP);
326332
}
327333
} while (!checkForOK(WIFI_CONNECT_TIMEOUT, true) && i++<2); // do twice if necessary but ignore failure as AP mode may still be ok
328334
if (i >= 2)

0 commit comments

Comments
 (0)