Skip to content

Commit 20f3b78

Browse files
committed
Enable station mode when starting WiFi
1 parent eb5a3ae commit 20f3b78

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Firmware/RTK_Surveyor/WiFi.ino

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,13 @@ void wifiStart(char* ssid, char* pw)
207207
#ifdef COMPILE_WIFI
208208
if ((wifiState == WIFI_OFF) || (wifiState == WIFI_ON))
209209
{
210+
WiFi.mode(WIFI_STA);
211+
210212
#ifdef COMPILE_ESPNOW
211-
//If ESP-Now is active, reconfigure protocols
212213
if (espnowState > ESPNOW_OFF)
213-
{
214-
Serial.println("Mixing WiFi into ESPNOW setup");
215-
//Enable WiFi + ESP-Now
216-
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR);
217-
}
214+
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR); //Enable WiFi + ESP-Now
218215
else
219-
{
220-
//Radio is off, turn it on
221-
WiFi.mode(WIFI_STA);
222-
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);
223-
}
216+
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); //Set basic WiFi protocols
224217
#else
225218
//Be sure the standard protocols are turned on. ESP Now have have previously turned them off.
226219
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

0 commit comments

Comments
 (0)