Skip to content

Commit 8594507

Browse files
authored
Merge pull request #3267 from cesanta/wifi
move debugging logs
2 parents c1ef477 + fa811ce commit 8594507

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

mongoose.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20701,10 +20701,8 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
2070120701
if (!cyw_init(ifp->mac)) return false;
2070220702

2070320703
if (wifi->apmode) {
20704-
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
2070520704
return mg_wifi_ap_start(wifi);
2070620705
} else if (wifi->ssid != NULL && wifi->pass != NULL) {
20707-
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
2070820706
return mg_wifi_connect(wifi);
2070920707
}
2071020708
return true;
@@ -22052,7 +22050,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
2205222050
s_ifp->mask = s_mask;
2205322051
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
2205422052
s_ifp->enable_dhcp_server = false;
22055-
MG_DEBUG(("Connecting to %s", wifi->ssid));
22053+
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
2205622054
return cyw_wifi_connect(wifi->ssid, wifi->pass);
2205722055
}
2205822056

@@ -22061,6 +22059,7 @@ bool mg_wifi_disconnect(void) {
2206122059
}
2206222060

2206322061
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
22062+
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
2206422063
return cyw_wifi_ap_start(wifi->apssid, wifi->appass, wifi->apchannel);
2206522064
}
2206622065

@@ -22485,14 +22484,12 @@ static bool mg_tcpip_driver_pico_w_init(struct mg_tcpip_if *ifp) {
2248522484
if (cyw43_arch_init() != 0)
2248622485
return false; // initialize async_context and WiFi chip
2248722486
if (wifi->apmode && wifi->apssid != NULL) {
22488-
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
2248922487
if (!mg_wifi_ap_start(wifi)) return false;
2249022488
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac); // same MAC
2249122489
} else {
2249222490
cyw43_arch_enable_sta_mode();
2249322491
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac);
2249422492
if (wifi->ssid != NULL) {
22495-
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
2249622493
return mg_wifi_connect(wifi);
2249722494
} else {
2249822495
cyw43_arch_disable_sta_mode();
@@ -22609,7 +22606,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
2260922606
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
2261022607
s_ifp->enable_dhcp_server = false;
2261122608
cyw43_arch_enable_sta_mode();
22612-
MG_DEBUG(("Connecting to %s", wifi->ssid));
22609+
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
2261322610
int res = cyw43_arch_wifi_connect_async(wifi->ssid, wifi->pass,
2261422611
CYW43_AUTH_WPA2_AES_PSK);
2261522612
MG_VERBOSE(("res: %d", res));
@@ -22624,6 +22621,7 @@ bool mg_wifi_disconnect(void) {
2262422621
}
2262522622

2262622623
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
22624+
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
2262722625
cyw43_wifi_ap_set_channel(&cyw43_state, wifi->apchannel);
2262822626
cyw43_arch_enable_ap_mode(wifi->apssid, wifi->appass,
2262922627
CYW43_AUTH_WPA2_AES_PSK);

src/drivers/cyw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
4646
if (!cyw_init(ifp->mac)) return false;
4747

4848
if (wifi->apmode) {
49-
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
5049
return mg_wifi_ap_start(wifi);
5150
} else if (wifi->ssid != NULL && wifi->pass != NULL) {
52-
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
5351
return mg_wifi_connect(wifi);
5452
}
5553
return true;
@@ -1397,7 +1395,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
13971395
s_ifp->mask = s_mask;
13981396
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
13991397
s_ifp->enable_dhcp_server = false;
1400-
MG_DEBUG(("Connecting to %s", wifi->ssid));
1398+
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
14011399
return cyw_wifi_connect(wifi->ssid, wifi->pass);
14021400
}
14031401

@@ -1406,6 +1404,7 @@ bool mg_wifi_disconnect(void) {
14061404
}
14071405

14081406
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
1407+
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
14091408
return cyw_wifi_ap_start(wifi->apssid, wifi->appass, wifi->apchannel);
14101409
}
14111410

src/drivers/pico-w.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ static bool mg_tcpip_driver_pico_w_init(struct mg_tcpip_if *ifp) {
3434
if (cyw43_arch_init() != 0)
3535
return false; // initialize async_context and WiFi chip
3636
if (wifi->apmode && wifi->apssid != NULL) {
37-
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
3837
if (!mg_wifi_ap_start(wifi)) return false;
3938
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac); // same MAC
4039
} else {
4140
cyw43_arch_enable_sta_mode();
4241
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac);
4342
if (wifi->ssid != NULL) {
44-
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
4543
return mg_wifi_connect(wifi);
4644
} else {
4745
cyw43_arch_disable_sta_mode();
@@ -158,7 +156,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
158156
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
159157
s_ifp->enable_dhcp_server = false;
160158
cyw43_arch_enable_sta_mode();
161-
MG_DEBUG(("Connecting to %s", wifi->ssid));
159+
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
162160
int res = cyw43_arch_wifi_connect_async(wifi->ssid, wifi->pass,
163161
CYW43_AUTH_WPA2_AES_PSK);
164162
MG_VERBOSE(("res: %d", res));
@@ -173,6 +171,7 @@ bool mg_wifi_disconnect(void) {
173171
}
174172

175173
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
174+
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
176175
cyw43_wifi_ap_set_channel(&cyw43_state, wifi->apchannel);
177176
cyw43_arch_enable_ap_mode(wifi->apssid, wifi->appass,
178177
CYW43_AUTH_WPA2_AES_PSK);

0 commit comments

Comments
 (0)