Is anyone having problems with 0.4.7 not always registering variables/functions in the Particle Cloud? In other words, Particle CLI list does not show any Variables or Functions (and the device is online). ....
I now say:
The problem only occurred for me with SYSTEM_THREAD(ENABLED), when DISABLED it registered okay in the cloud. The problem was not consistent across devices, ie it worked okay on some devices.
The same issue came up with firmware 0.4.6.
The fix was to move the registration calls early on in the setup() function, not down amongst it where I was waiting for Particle Cloud connection to come up before registration.
Glad to hear you got it working, although I’d still like to see your code to reproduce the issue. The functions and variables should appear no matter where they are in startup.
@mdma, the code (some 7000 lines of it) is pretty complicated (and no doubt the issue)!
Hopefully I will be able to set up some test code that reproduces the fault and get this to you if it does.
Note that I was waiting for WiFi connected and Particle Cloud connection before registration. Did this because prior to v0.4.6, I found that when there was no WiFi connection, the function registration blocked for some time. Have not checked if this block occurs with 0.4.6.
We can avoid this by taking additional steps to make some of the internal code truly thread safe so it’s run on the calling thread, rather than always on the system thread. This will happen in a future release. (Multithreading is still beta so we can work out these issues.)
For what it’s worth, this issue still exists in 0.6.2. I have to move my function declarations to the top of Setup() to get them to register (semi_automatic / system thread enabled). Glad this thread existed, but I wouldn’t quite call it [SOLVED] yet.
The function did not register even though result was being returned as true. I had to move the function registration to the top of my setup function prior to the call to Particle.connect() for it to show up in the particle console.
Basically the message to the cloud that describes all the functions and variables is currently sent once and asynchronously with respect to user code during setup().
This requires both the firmware side and the cloud side to change in order to fix it and there is an easy work-around (declare early) so I don’t think this is currently scheduled.