App code runs slow when no Internet

Hello everyone,

I am having an issue with my Photon where the app code runs very slowly when I have no internet. I was hoping to use it for a GPS speedometer. It works perfectly when I am in the yard with internet but once I leave and loose internet (flashing green) the screen updates seem to slow down to once every few minutes.

Does the photon spend more time looking for internet than running app code? Is there a way around this?

Thanks in advance.

Yes there is. It’s written in a wonderful adventure story called “the docs”. Once you get hooked, you’ll find that it contains so much more than you previously anticipated… :wink:
https://docs.particle.io/support/troubleshooting/mode-switching/photon/
https://docs.particle.io/reference/firmware/photon/#system-modes
https://docs.particle.io/reference/firmware/photon/#system-thread

1 Like

I found SYSTEM_THREAD(ENABLED);

This should work right?

It should, but you have to be aware that it still is a beta feature, so you might see “minor” issues depending on your use of the feature.

However, you should still choose the most fitting SYSTEM_MODE() for your needs to avoid wasting time in the (background) system thread either.

1 Like

It seems to be working fine at the moment. I will do some more testing. Thanks. I will make use of the other modes as well. Thank you.

I’m experiencing similar issue with my Electron, having SYSTEM_THREAD enabled. What happens is that the app code runs quick and smooth all the way until it disconnects for various reasons, then when entering the “looking for internet” mode (flashing green), my two tactile buttons go from being responsive (triggers a screen update) up to ~10 clicks a second to a mere ~2 clicks per second. I’ve noticed that printing to my OLED (SSD1306 drivers with mfGFX library) screen obviously puts the CPU to work, since not printing to it while Electron flashing keeps the responsive behavior of the buttons.

Is there any workaround on this, or is it just that this “connecting” phase simply very demanding? I’ve tried to reduce the amount of pixels to print by not using clearDisplay, but printing a small rectangle over the area that needs to be updated.

I too have this issue. Interestingly, when the device is entirely out of range (i.e. no hope of having a signal), the application code appears to run at normal or close to normal speed (sorry for the lack of scientific measurement). But when it is getting into range (at the edge) the application thread just crawls.

Interrupts remain operative at their expected speed no matter what connectivity state the device is in.