Skip to content

Commit

Permalink
Support setting channel for SoftAP
Browse files Browse the repository at this point in the history
Fixes #2694
  • Loading branch information
earlephilhower committed Dec 17, 2024
1 parent dc0dc50 commit 2d5f2da
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libraries/WiFi/src/WiFiClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,26 @@ uint8_t WiFiClass::beginAP(const char *ssid) {
}

uint8_t WiFiClass::beginAP(const char *ssid, uint8_t channel) {
(void) channel;
return beginAP(ssid, nullptr);
return beginAP(ssid, nullptr, channel);
}

uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase, uint8_t channel) {
(void) channel;
return beginAP(ssid, passphrase);
uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
return beginAP(ssid, passphrase, 0);
}

uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase, uint8_t channel) {
end();

_ssid = ssid;
_password = passphrase;
_wifi.setAP();
_wifi.setSSID(_ssid.c_str());
_wifi.setPassword(passphrase);
#if defined(PICO_CYW43_SUPPORTED)
if (channel > 0) {
cyw43_wifi_ap_set_channel(&cyw43_state, channel);
}
#endif
_wifi.setTimeout(_timeout);
_apMode = true;
IPAddress gw = _wifi.gatewayIP();
Expand Down

0 comments on commit 2d5f2da

Please sign in to comment.