WiFi does not reconnect once connection is lost, but keeps breathing Cyan

I’ve done some further testing and it seems that this problem is even weirder. It is not related to my cage of Faraday at all. It seems to be related to my specific router.

If I connect my Spark to my router and monitor using the code below, I get about a minute of good readings and than WiFi.RSSI() returns 2 (timeout) while WiFI.ready() returns true and WiFi.SSID() returns my SSID. So, I am connected, but the RSSI gets a timeout. I check if I am really connected by also publishing the same info to the cloud and listening (using CLI) on my laptop. I am still connected, while I get the timeout at WiFi.RSSI(). By playing around with the time between measurements, I see that the problem is independent of the amount of WiFI.RSSI() calls that I make, it happens after about a minute.

I do not get this problem when I connect using my iPhone as a WiFi hotspot. My router is a Thompson cable-modem and router combo thing that I get from UPC with my internet subscription.

anyone any thoughts??

thanks in advance

Rolf

PS my code:

#define DEBUG_SERIAL true

#define MEASUREMENT_INTERVAL 5000

int i = 0;
void setup() {    
    if (DEBUG_SERIAL) Serial.begin(9600);
}

void loop() {
    
    if ((millis() % MEASUREMENT_INTERVAL) < 10){
        int measurement = WiFi.RSSI();
        String SSID = WiFi.SSID();
        bool connected = WiFi.ready();
        
        //TODO something with uploading to internet
        Spark.publish("isConnected",(String) connected);
        Spark.publish("isConnectedTo", SSID);
        Spark.publish("measurementRSSI",(String) measurement);
        
        if (DEBUG_SERIAL) {
            Serial.print(i++);
            Serial.print(" ");
            Serial.print(connected);
            Serial.print(" ");
            Serial.print(SSID);
            Serial.print(" ");
            Serial.println(measurement);
        }
        delay(10);
    }    
}

I’ve edited your post to properly format the code. Please check out this post, so you know how to do this yourself in the future. Thanks in advance! ~Jordy