After flashign, I was able to call the function via CURL once. I know it works as I got an array of LEDs connected and they walked up once. Then when I tried this again, it says function not found.
Could it be that it somehow hits an issue and reverts to an old version that does not have the function?
Do you have a check on this endpoint that does list the function before you call it? As far as I know it shouldn’t auto-rollback like that once your firmware has started running.
function is available (check via call you gave me),
function called successfully
second check - function no longer exists ???
second call, “Function not available”.
How can I figure out why the function goes away? One thing that is strange is this: after the first function seems to run successfully, the spark starts flashing green and then breathes cyan again. So it does something, that I find strange - what is that? Is is reinitializing, but maybe not setting up functions again?
Hmm, that would be really strange, your firmware would need to be messing with system flags and messing with memory to create a bug like that I would think. Can you post the full firmware and maybe we can try to reproduce it here?
The lights function is called with a String like “3” which is converted to an integer and then the individual bits are read to determine which of the 16 channels is on and off. I just had this code repetively running when the NeoPixel Lib was not included. Once I added the .h/.cpp and include + code for controlling the NeoPixel LEDs, it stopped working again. The function is no longer there…
I believe the code is hanging due to the library calls to NeoPixel stuff because there is no strip.begin(); in the setup. Also missing strip.show()'s. Posted in the NeoPixel Library thread
User Code Hanging = No User Data Available to the cloud.
Thanks @BDub , that sounds correct. @hansamann , a bit more context in case it’s useful:
You can run into problems if you call hardware initialization routines like pinMode outside of setup (before the hardware is ready). If you look at the implementation of neopixel , it’s begin() method does this–and should therefore be called in setup.
Hi @BDub and @jgoggins - I’ve updated my program and added the begin() and show() calls in setup, also after each time I am updating the NeoPixel strip. Unfortunately it still does not work and the behaviour is again very weird.
I now do a POST to that device’s lights function. with the Integer 3 for example, which will based on the code turn on the light channels 0 and 1 (3 binary). The call takes pretty long, In between the cyan quickly flashed after it started breathing again. The response was:
{
“error”: “Timed out.”
}
I now call the device info again, like above to see of the function is there.
function is gone There was also nothing happening on the connectd RGB leds.
Pretty clueless. It works if I take out the strip/NeoPixel calls. But of course that is the main idea of the program, drive the neopixels with input via that function call.
I am trying to seperate the code that is called via the spark function from the code that operates the light channels. The idea is that the spark function can also return very quickly and does not block a long time.
So the loop now goes through the mychannels[] array and then updates the strip accordingly.
I’ve also taken out the Serial calls - just thought in case something goes wrong here.
Unfortunately, I can see via the GET /device call that the fucntion is there. But all the function calls for the lights function time out. I always get a timed out response.
It might be a tiny issue with the code, but as it all compiles and I cannot have a debugging view to the device, it’s hard to tell. Does anyone see an issue?
@BDub has solved the issue. It seems my code calculates a value that causes the NeoPixel lib to fail. He changed and fixed the issue, now I am trying to come back to my version and figure out what causes teh behavior in the NeoPixel lib. It will be around my usage of int (due to lack of knowledge of c) compared to uint16_t for example.