Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit abb8ea9

Browse filesBrowse files
copercinime-no-dev
authored andcommitted
Fix WiFiMulti Logs (espressif#1690)
1 parent 30b3eeb commit abb8ea9
Copy full SHA for abb8ea9

File tree

Expand file treeCollapse file tree

2 files changed

+22
-39
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-39
lines changed

‎libraries/WiFi/src/WiFiMulti.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiMulti.cpp
+22-29Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
6060
uint8_t bestBSSID[6];
6161
int32_t bestChannel = 0;
6262

63-
DEBUG_WIFI_MULTI("[WIFI] scan done\n");
64-
delay(0);
63+
log_i("[WIFI] scan done");
6564

6665
if(scanResult <= 0) {
67-
DEBUG_WIFI_MULTI("[WIFI] no networks found\n");
66+
log_e("[WIFI] no networks found");
6867
} else {
69-
DEBUG_WIFI_MULTI("[WIFI] %d networks found\n", scanResult);
68+
log_i("[WIFI] %d networks found", scanResult);
7069
for(int8_t i = 0; i < scanResult; ++i) {
7170

7271
String ssid_scan;
@@ -96,24 +95,18 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
9695
}
9796

9897
if(known) {
99-
DEBUG_WIFI_MULTI(" ---> ");
98+
log_d(" ---> %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*');
10099
} else {
101-
DEBUG_WIFI_MULTI(" ");
100+
log_d(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*');
102101
}
103-
104-
DEBUG_WIFI_MULTI(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c\n", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*');
105-
delay(0);
106102
}
107103
}
108104

109105
// clean up ram
110106
WiFi.scanDelete();
111107

112-
DEBUG_WIFI_MULTI("\n\n");
113-
delay(0);
114-
115108
if(bestNetwork.ssid) {
116-
DEBUG_WIFI_MULTI("[WIFI] Connecting BSSID: %02X:%02X:%02X:%02X:%02X:%02X SSID: %s Channal: %d (%d)\n", bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3], bestBSSID[4], bestBSSID[5], bestNetwork.ssid, bestChannel, bestNetworkDb);
109+
log_i("[WIFI] Connecting BSSID: %02X:%02X:%02X:%02X:%02X:%02X SSID: %s Channal: %d (%d)", bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3], bestBSSID[4], bestBSSID[5], bestNetwork.ssid, bestChannel, bestNetworkDb);
117110

118111
WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID);
119112
status = WiFi.status();
@@ -131,31 +124,31 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
131124
case 3:
132125
ip = WiFi.localIP();
133126
mac = WiFi.BSSID();
134-
DEBUG_WIFI_MULTI("[WIFI] Connecting done.\n");
135-
DEBUG_WIFI_MULTI("[WIFI] SSID: %s\n", WiFi.SSID());
136-
DEBUG_WIFI_MULTI("[WIFI] IP: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
137-
DEBUG_WIFI_MULTI("[WIFI] MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
138-
DEBUG_WIFI_MULTI("[WIFI] Channel: %d\n", WiFi.channel());
127+
log_i("[WIFI] Connecting done.");
128+
log_d("[WIFI] SSID: %s", WiFi.SSID());
129+
log_d("[WIFI] IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
130+
log_d("[WIFI] MAC: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
131+
log_d("[WIFI] Channel: %d", WiFi.channel());
139132
break;
140133
case 1:
141-
DEBUG_WIFI_MULTI("[WIFI] Connecting Failed AP not found.\n");
134+
log_e("[WIFI] Connecting Failed AP not found.");
142135
break;
143136
case 4:
144-
DEBUG_WIFI_MULTI("[WIFI] Connecting Failed.\n");
137+
log_e("[WIFI] Connecting Failed.");
145138
break;
146139
default:
147-
DEBUG_WIFI_MULTI("[WIFI] Connecting Failed (%d).\n", status);
140+
log_e("[WIFI] Connecting Failed (%d).", status);
148141
break;
149142
}
150143
} else {
151-
DEBUG_WIFI_MULTI("[WIFI] no matching wifi found!\n");
144+
log_e("[WIFI] no matching wifi found!");
152145
}
153146
} else {
154147
// start scan
155-
DEBUG_WIFI_MULTI("[WIFI] delete old wifi config...\n");
148+
log_d("[WIFI] delete old wifi config...");
156149
WiFi.disconnect();
157150

158-
DEBUG_WIFI_MULTI("[WIFI] start scan\n");
151+
log_d("[WIFI] start scan");
159152
// scan wifi async mode
160153
WiFi.scanNetworks(true);
161154
}
@@ -172,34 +165,34 @@ bool WiFiMulti::APlistAdd(const char* ssid, const char *passphrase)
172165

173166
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
174167
// fail SSID to long or missing!
175-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] no ssid or ssid to long\n");
168+
log_e("[WIFI][APlistAdd] no ssid or ssid to long");
176169
return false;
177170
}
178171

179172
if(passphrase && strlen(passphrase) > 63) {
180173
// fail passphrase to long!
181-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] passphrase to long\n");
174+
log_e("[WIFI][APlistAdd] passphrase to long");
182175
return false;
183176
}
184177

185178
newAP.ssid = strdup(ssid);
186179

187180
if(!newAP.ssid) {
188-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.ssid == 0\n");
181+
log_e("[WIFI][APlistAdd] fail newAP.ssid == 0");
189182
return false;
190183
}
191184

192185
if(passphrase && *passphrase != 0x00) {
193186
newAP.passphrase = strdup(passphrase);
194187
if(!newAP.passphrase) {
195-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.passphrase == 0\n");
188+
log_e("[WIFI][APlistAdd] fail newAP.passphrase == 0");
196189
free(newAP.ssid);
197190
return false;
198191
}
199192
}
200193

201194
APlist.push_back(newAP);
202-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] add SSID: %s\n", newAP.ssid);
195+
log_i("[WIFI][APlistAdd] add SSID: %s", newAP.ssid);
203196
return true;
204197
}
205198

‎libraries/WiFi/src/WiFiMulti.h

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiMulti.h
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@
3131
#undef max
3232
#include <vector>
3333

34-
#ifdef DEBUG_ESP_WIFI
35-
#ifdef DEBUG_ESP_PORT
36-
#define DEBUG_WIFI_MULTI(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
37-
#endif
38-
#endif
39-
40-
#ifndef DEBUG_WIFI_MULTI
41-
#define DEBUG_WIFI_MULTI(...)
42-
#endif
43-
4434
typedef struct {
4535
char * ssid;
4636
char * passphrase;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.