Merge pull request #3267 from cesanta/wifi

move debugging logs
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2025-09-09 16:24:16 -03:00
commit 8594507b5b
3 files changed
+8 -12

No files matched your search

+4 -6
View File
@@ -20701,10 +20701,8 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
if (!cyw_init(ifp->mac)) return false;
if (wifi->apmode) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
return mg_wifi_ap_start(wifi);
} else if (wifi->ssid != NULL && wifi->pass != NULL) {
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return mg_wifi_connect(wifi);
}
return true;
@@ -22052,7 +22050,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
s_ifp->mask = s_mask;
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
s_ifp->enable_dhcp_server = false;
MG_DEBUG(("Connecting to %s", wifi->ssid));
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return cyw_wifi_connect(wifi->ssid, wifi->pass);
}
@@ -22061,6 +22059,7 @@ bool mg_wifi_disconnect(void) {
}
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
return cyw_wifi_ap_start(wifi->apssid, wifi->appass, wifi->apchannel);
}
@@ -22485,14 +22484,12 @@ static bool mg_tcpip_driver_pico_w_init(struct mg_tcpip_if *ifp) {
if (cyw43_arch_init() != 0)
return false; // initialize async_context and WiFi chip
if (wifi->apmode && wifi->apssid != NULL) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
if (!mg_wifi_ap_start(wifi)) return false;
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac); // same MAC
} else {
cyw43_arch_enable_sta_mode();
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac);
if (wifi->ssid != NULL) {
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return mg_wifi_connect(wifi);
} else {
cyw43_arch_disable_sta_mode();
@@ -22609,7 +22606,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
s_ifp->enable_dhcp_server = false;
cyw43_arch_enable_sta_mode();
MG_DEBUG(("Connecting to %s", wifi->ssid));
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
int res = cyw43_arch_wifi_connect_async(wifi->ssid, wifi->pass,
CYW43_AUTH_WPA2_AES_PSK);
MG_VERBOSE(("res: %d", res));
@@ -22624,6 +22621,7 @@ bool mg_wifi_disconnect(void) {
}
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
cyw43_wifi_ap_set_channel(&cyw43_state, wifi->apchannel);
cyw43_arch_enable_ap_mode(wifi->apssid, wifi->appass,
CYW43_AUTH_WPA2_AES_PSK);
+2 -3
View File
@@ -46,10 +46,8 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
if (!cyw_init(ifp->mac)) return false;
if (wifi->apmode) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
return mg_wifi_ap_start(wifi);
} else if (wifi->ssid != NULL && wifi->pass != NULL) {
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return mg_wifi_connect(wifi);
}
return true;
@@ -1397,7 +1395,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
s_ifp->mask = s_mask;
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
s_ifp->enable_dhcp_server = false;
MG_DEBUG(("Connecting to %s", wifi->ssid));
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return cyw_wifi_connect(wifi->ssid, wifi->pass);
}
@@ -1406,6 +1404,7 @@ bool mg_wifi_disconnect(void) {
}
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
return cyw_wifi_ap_start(wifi->apssid, wifi->appass, wifi->apchannel);
}
+2 -3
View File
@@ -34,14 +34,12 @@ static bool mg_tcpip_driver_pico_w_init(struct mg_tcpip_if *ifp) {
if (cyw43_arch_init() != 0)
return false; // initialize async_context and WiFi chip
if (wifi->apmode && wifi->apssid != NULL) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
if (!mg_wifi_ap_start(wifi)) return false;
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac); // same MAC
} else {
cyw43_arch_enable_sta_mode();
cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, ifp->mac);
if (wifi->ssid != NULL) {
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
return mg_wifi_connect(wifi);
} else {
cyw43_arch_disable_sta_mode();
@@ -158,7 +156,7 @@ bool mg_wifi_connect(struct mg_wifi_data *wifi) {
if (s_ifp->ip == 0) s_ifp->enable_dhcp_client = true;
s_ifp->enable_dhcp_server = false;
cyw43_arch_enable_sta_mode();
MG_DEBUG(("Connecting to %s", wifi->ssid));
MG_DEBUG(("Connecting to '%s'", wifi->ssid));
int res = cyw43_arch_wifi_connect_async(wifi->ssid, wifi->pass,
CYW43_AUTH_WPA2_AES_PSK);
MG_VERBOSE(("res: %d", res));
@@ -173,6 +171,7 @@ bool mg_wifi_disconnect(void) {
}
bool mg_wifi_ap_start(struct mg_wifi_data *wifi) {
MG_DEBUG(("Starting AP '%s' (%u)", wifi->apssid, wifi->apchannel));
cyw43_wifi_ap_set_channel(&cyw43_state, wifi->apchannel);
cyw43_arch_enable_ap_mode(wifi->apssid, wifi->appass,
CYW43_AUTH_WPA2_AES_PSK);