Hi,
I suspect there is a problem with the new(ish) SYSTEM_THREAD mode.
I have an app which quite happily builds and loads into my target and reboots the target as soon as the new code is loaded. The DEV compiler tells me ‘Success…’
I thought I should try out the multi-task SYSTEM_THREAD mode…
S0…- if I add ‘SYSTEM_THREAD(ENABLED);’ in my primary ino file (right near the top after the #includes) - my app now takes a further 20 seconds plus before it reboots. The old code is still running.
Dev tells me all is OK - but the app doesn’t restart - I noticed because I have a USB serial port and get the drop sound from the driver followed by driver start sound when my Photon reboots.
Sit there and wait for 20 secs or so - and reboot :-O.
NB I have repeated this a dozen or more times and each time I comment or uncomment the SYSTEM_THREAD line the behaviour changes.
I DO use the new software timers, but these work just the same on both compiled versions…
Seems that something is holding back a reboot after upgrade when in multi-tasker mode :-O.
In fact its even more bizarre - as I also define some cloud variables during init, and in SYSTEM_THREAD(ENABLED) mode - these don’t even get defined properly (ie not visible in ‘particle list’
This is the end of my setup code
//********************************************************************
//********************************************************************
waitUntil(Particle.connected);
Serial.print("\r\nOK looks like we're connected then...");
//********************************************************************
//********************************************************************
dbg.Init(56100, controller.getBanner());
myudp.Init(56200, controller.getBanner());
Particle.variable("version", ver);
Particle.variable("currTime", now);
Particle.variable("freeMem", freeMem);
//OK so finally start up the system timers
setupTimers();
Serial.print("\r\nTimers setup");
}
Hope this is enough detail to reproduce, please ask if not…
I added the waituntil after starting multi-tasking mode - just to be sure as the docs say that setup is run sooner in this mode - before wifi is up…
BR
Graham