With the same firmware code. After I have upgraded from OS v1.4.4 to v1.5.0, I am not able to setup WiFi through serial or through the softAP anymore. I did discover during listening mode (softAP on) I had around 17000 Bytes of free memory with my firmware in OS v1.4.4 and went to around 1000 Bytes of free memory with the same firmware in OS v1.5.0. With SoftAP off, 35000 bytes for v1.4.4 and 25000 bytes for v1.5.0
I freed modified my firmware to have around 5000 Bytes of free memory without success. My firmware will work fine though if the P1 already stored a WiFi credential. After I am connected to the cloud, the free memory is around 25000 bytes.
Does anyone know what could have caused the situation?
Below is some important code pieces that I believe will be useful for the diagnosis.
STARTUP(System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK));
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);
STARTUP(WiFi.selectAntenna(ANT_AUTO));
...Some user Code...
void loop(){
...Some user Code...
if(!Particle.connected() && current_time > last_wifi_check + WIFI_CHECK_INTERVAL){
num_of_stored_wifi = WiFi.getCredentials(stored_ap, 5);
int num_of_available_wifi = WiFi.scan(available_ap, 20);
if(num_of_stored_wifi <= 0){
Serial.printf("\n\nNO WIFI Credential Stored\n\n");
WiFi.listen();
}
bool default_wifi_available = false;
for (int i = 0; i < num_of_stored_wifi; i++) {
WiFiAccessPoint& stored_wifi_ap = stored_ap[i];
for (int j = 0; j < num_of_available_wifi; j++) {
WiFiAccessPoint& available_wifi_ap = available_ap[j];
if(String(stored_wifi_ap.ssid).equals(String(available_wifi_ap.ssid)) && stored_wifi_ap.security == available_wifi_ap.security && available_wifi_ap.rssi > -100){
WiFi.connect();
Particle.connect();
i = num_of_stored_wifi;
wifi_initial_startup = false;
Serial.printf("\nWiFi Credential Found! Reconnecting\n");
break;
}
}
}
}
}
...Some user Code...