Photon/P1 Unable to connect to setup WiFi after upgrade to OS v1.5.0

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...

Your free memory seems very low for softAP to operate - I have found 38K to be the minimum before starting the setup process because of the amount of RAM used is circa 23K and odd things start to happen once the heap gets below 15K. It could be that 1.5.0 has changed these numbers again.

I see. I’ll try to free up some RAM and let ya know how it goes. When you say odd things start to happen, could you give some examples? I want to compare if I experience similar issues

Can confirm that free memory is a problem with DeviceOS v1.5.0, especially with softAP.

Freezing, if you have a AWD then that will be triggered to reset, possibly flashing SOS - low heap…etc.

I have just created an issue for this. Only just saw this thread.