Hi everyone, I got up this morning and found that my Photon was doing the SOS+5 (usage error) red blink. However, I had not reflashed or changed any code with it recently, and it had worked fine prior.
I tried reflashing my code to it several times, to no avail, and then reflashed tinker. Tinker succeeded in getting it out of the SOS loop. I then reflashed my own code to it, and it went back to SOS.
So, I figured maybe I was missing a semicolon or dividing by zero somewhere in my code (I’d heard that can cause SOS+5). In the process of browsing my code, the Photon rebooted and ran the code just fine, and has been doing so ever since.
So, my question is, does anyone have any idea what would cause perfectly functioning code to suddenly throw an SOS+5 for a couple hours and then go back to functioning normally?
Thanks! If you need to see my code, I’ll be happy to oblige; however, I may need some help finding the best way to post it, since it’s 1400+ lines.
Since we don't know how much the environment may impact your setup (e.g. sensor readings) it's hard to tell.
But "perfectly functioning" may be an assumption that's just proven void by the fact of the crash
You may just not have caught all the edge cases, so when your code works well within the boundaries it behaves well but when once you touch the edge-case it may crash and hence it's not actually functioning perfectly.
Also some memory corruption - also due to rare conditions - might have this side effect.
That’s perfectly true- the crash does show it to not be “perfectly” functioning.
Given what you said about sensor readings, what sort of readings might cause it to do that? I’ve a temperature sensor, humidity sensor, and pressure sensor.
If there’s not much more you can tell me, that’s fine too. Just kinda fishing for some info in case it happens again. Thanks for your reply!
Memory corruption usually happens as the result of writing beyond the bounds of an array, including a c-string, so you might look for those in your code. Also, as you mentioned, it could be a divide by zero, if there’s a possibility of that in your code. If you made the project in the web IDE, you can hit the share button to get a link to your project, so we can look at the code.