Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e3918fe

Browse files
committedMar 21, 2025·
MODE AP_STA
1 parent f032b82 commit e3918fe

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
 

‎libraries/WiFiS3/src/WiFi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ int CWifi::begin(const char* ssid) {
4242
}
4343

4444
/* -------------------------------------------------------------------------- */
45-
int CWifi::begin(const char* ssid, const char *passphrase) {
45+
int CWifi::begin(const char* ssid, const char *passphrase, uint8_t mode) {
4646
/* -------------------------------------------------------------------------- */
4747
string res = "";
4848
modem.begin();
49-
modem.write(string(PROMPT(_MODE)),res, "%s%d\r\n" , CMD_WRITE(_MODE), 1);
49+
modem.write(string(PROMPT(_MODE)),res, "%s%d\r\n" , CMD_WRITE(_MODE), mode);
5050

5151
if(passphrase == nullptr) {
5252
if(!modem.write(string(PROMPT(_BEGINSTA)),res, "%s%s\r\n" , CMD_WRITE(_BEGINSTA), ssid)) {
@@ -400,7 +400,7 @@ IPAddress CWifi::localIP() {
400400
IPAddress local_IP(0,0,0,0);
401401

402402
if(modem.write(string(PROMPT(_MODE)),res, "%s" , CMD_READ(_MODE))) {
403-
if(atoi(res.c_str()) == 1) {
403+
if(atoi(res.c_str()) == 1 || atoi(res.c_str()) == 3) {
404404
if(modem.write(string(PROMPT(_IPSTA)),res, "%s%d\r\n" , CMD_WRITE(_IPSTA), IP_ADDR)) {
405405
local_IP.fromString(res.c_str());
406406
}

‎libraries/WiFiS3/src/WiFi.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ class CWifi {
112112
/* Start WiFi connection with passphrase
113113
* the most secure supported mode will be automatically selected
114114
*
115-
* @param `ssid` Pointer to the SSID string.
116-
* @param `passphrase` Passphrase. Valid characters in a passphrase
117-
* must be between ASCII 32-126 (decimal).
115+
* param ssid: Pointer to the SSID string.
116+
* param passphrase: Passphrase. Valid characters in a passphrase
117+
* must be between ASCII 32-126 (decimal).
118+
* param mode: WiFi mode: STA, AP or AP_STA (mixed)
118119
*/
119-
int begin(const char* ssid, const char *passphrase);
120+
int begin(const char* ssid, const char *passphrase, uint8_t mode = 1);
120121

121122
/**
122123
* @brief Starts a Wi-Fi Access Point with the specified SSID.

0 commit comments

Comments
 (0)
Please sign in to comment.