Particle Photon freezes while shining a constant blue/cyan light. Needs to be reset in order to function again

Basically what the title says. We have a client with a couple of Photons that seem to have this issue. They lose connection and basically completely freeze with the RGD LED shining a constant blue/cyan color.

I can’t seem to find any community posts regarding this issue. Anyone have any ideas?

Hi,
Welcome to the community :+1:
It’s hard to say what can cause this behavior without seeing your code.
Looks like something is hanging your application loop()
are you running SYSTEM_THREAD(ENABLED) ?
could you show us your code ?

Hi, thanks for the response.

SYSTEM_THREAD(ENABLED) is being run.

the thing is it only happens to three devices out of 20. So it’s hard to see that it’s in the code.

void loop()
 {
    if (millis() - lastSync > ONE_DAY_MILLIS) 
    {
        Particle.syncTime();
        lastSync = millis();
    }  
// SYNC TIME WITH CLOUD
    hour = Time.hour();
    minute = Time.minute();

// PUMP AND LIGHT MAIN FUNCTIONS   
    if (pumpStatus != 1) pumpSchedule(hour, minute);
    if (lightStatus != 1) lightSchedule(hour, minute);


// WATER LEVEL CHECK
    if ((hour == waterHour) && (minute == waterMinute) && (firstCheck = FALSE))
    {
        waterLevel();
    }
    else if (minute != waterMinute && (firstCheck = TRUE))
    {
        firstCheck = FALSE;
    }
// RESETS THE AWDT COUNT     
    wd->checkin(); 
}

This is the loop function.

@edmirsuljic, normally when the LED is frozen it is caused by a deadlock in the FreeRTOS threads. Which deviceOS are these devices running? Have you recently update the code and/or DeviceOS?

All the devices are running 2.0.1, and the devices have been running the same code for a couple of weeks. We do minor tweaks now and again for the client but its mostly the same.

@edmirsuljic, are these registered as products? Also, are only devices you made “minor tweaks” experiencing the problem? Is there something different in the three units such as power source, WiFi strength, hardware, etc?

This part of code is intentional ? as you not compare just assign FALSE to firstCheck and the same here:

you assign TRUE to firstCheck also not sure if TRUE and FALSE shouldn’t be lowercase ? as true/false but I guess is predefined somewhere as a macro #define TRUE true and #define False false (as is compiling fine) also what about:

what those functions are doing ?

Those tests are using assignment operator, not equality test.

Prefer this idiom:

&& (TRUE == firstCheck)

The compiler will catch the error for you.

1 Like

No they arent registered as products (if you mean the “products” tab in the console). No, more devices have been updated with these “minor tweaks”. They are all using the same hardware but are located in different places. However two of these are located amongst a couple of other devices that are not experiencing these issues. Wifi has been an issue on some of them but I guess that shouldnt cause the device to freeze completely, requiring a reset?

I am sure that it is not that part of the code, if it even has anything to do with the code since the other 17 devices are running fine and have been for almost a year.

Maybe not but this part of code doesn’t have any sense IMHO.
That’s why ask you