- Fri Aug 23, 2019 5:36 pm
#83565
I'm not so sure the channel is the issue. Here is a very simple bit of code that demonstrates the issue. If I push that to any of my devices and connect to its access point, grab its ip and get a long ping on that ip going; I get dropped packets once it hits the 60 second mark which is when the station mode starts up. Prior to the 60 second mark I don't drop a single packet. The device doesn't even have to connect to a real router. In this case I literally use the code below so the device isn't connecting to any real router and it still drops tons of packets after the station mode starts up.
Code: Select all#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_AP_STA);
WiFi.setAutoConnect(false);
if(!WiFi.softAP("motion-sensor", "password", 5)) {
Serial.println("Starting soft-AP Failed! Rebooting...");
delay(5000);
ESP.restart();
}
}
const unsigned long start = millis();
bool stationStarted = false;
void loop() {
if (!stationStarted) {
if (millis() - start > 60000) {
stationStarted = true;
Serial.println("connecting as station");
WiFi.begin("fake-ssid", "fake-password", 5);
} else {
Serial.print("time: ");
Serial.println(millis() - start);
}
}
delay(1000);
}