Skip to content

Commit

Permalink
Allow passing beacon interval to SoftAP config (#8695)
Browse files Browse the repository at this point in the history
allow passing beacon_interval to the softAP
  • Loading branch information
piotrcurious authored Jan 5, 2023
1 parent 3f39461 commit 3e357f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r
* @param channel WiFi channel number, 1 - 13.
* @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID)
* @param max_connection Max simultaneous connected clients, 0 - 8. https://bbs.espressif.com/viewtopic.php?f=46&t=481&p=1832&hilit=max_connection#p1832
* @param beacon_interval set arbitrary beacon interval (influences DTIM)
*/
bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel, int ssid_hidden, int max_connection) {
bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel, int ssid_hidden, int max_connection, int beacon_interval) {

if(!WiFi.enableAP(true)) {
// enable AP failed
Expand Down Expand Up @@ -138,7 +139,7 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel,
conf.channel = channel;
conf.ssid_hidden = ssid_hidden;
conf.max_connection = max_connection;
conf.beacon_interval = 100;
conf.beacon_interval = beacon_interval;

struct softap_config conf_compare;
if(WiFi._persistent){
Expand Down Expand Up @@ -189,8 +190,8 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel,
return ret;
}

bool ESP8266WiFiAPClass::softAP(const String& ssid, const String& psk, int channel, int ssid_hidden, int max_connection) {
return softAP(ssid.c_str(), psk.c_str(), channel, ssid_hidden, max_connection);
bool ESP8266WiFiAPClass::softAP(const String& ssid, const String& psk, int channel, int ssid_hidden, int max_connection, int beacon_interval) {
return softAP(ssid.c_str(), psk.c_str(), channel, ssid_hidden, max_connection, beacon_interval);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions libraries/ESP8266WiFi/src/ESP8266WiFiAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ESP8266WiFiAPClass {

public:

bool softAP(const char* ssid, const char* psk = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4);
bool softAP(const String& ssid,const String& psk = emptyString,int channel = 1,int ssid_hidden = 0,int max_connection = 4);
bool softAP(const char* ssid, const char* psk = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4, int beacon_interval = 100);
bool softAP(const String& ssid,const String& psk = emptyString,int channel = 1,int ssid_hidden = 0,int max_connection = 4,int beacon_interval = 100);
bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
bool softAPdisconnect(bool wifioff = false);

Expand Down

0 comments on commit 3e357f3

Please sign in to comment.