Everything was working well until one time after flashing the Photon using the Web UI it got flashed (magenta flashing) and then when it was re starting, it went into Listen Mode instead of running the application code.
I tried putting it into Safe Mode, but as soon as I release the Setup Button (after I see the Magenta start to Flash) it goes back into Listen Mode
I’ve tried putting into WiFi Reset mode (using both methods) but the same thing happens. As soon as I leave the Setup button, it goes back into Listen mode.
I can flash the device locally using CLI but once again, when it restarts it goes into listen mode.
When I use the CLI to set up the wifi credentials, the Photon restarts and works as expected all by itself. But that’s the only way I can get it to work. That is flash, then set up Wifi credentials and let it restart.
I’ve downloaded the dfu util, but I’m not sure how to “install” it. It does go into DFU model (took a few tried but it stayed blinking yellow), but I’m at loss WRT the dfu util.
Ok, I “saved” the code in the IDE and recompiled
I setup the wifi using CLI
Then Flashed it using the Web IDE and it worked this time.
So it looks like the Web IDE doesn’t save the code and then Compile and Flash (like most IDEs I’m used to). So when you mentioned the clearCrdentials() method causes this (for me that was confirmation of a hunch I had), I figured the only thing that could explain why the behavior is not changing even after I changed my code, was that the IDE doesn’t save the code in the editor prior to compiling and flashing.
Yes, although if you don’t have any credentials safe mode will still blink blue as it tries to connect to the cloud but doesn’t have any credentials. This is nothing to do with running user code.
So try this:
enter DFU mode
run particle flash --usb tinker
setup credentials vial the CLI
verify the device connects to the cloud
flash tinker a few more times - try safe mode, and satisfy yourself the device is working normally.
now flash your code. If the photon starts misbehaving you know it’s a problem in your code. You mentioned WiFI.clearCredentails() isn’t present any more - could you have made a mistake there and flashed the wrong version?