Limits on the amount of varibles read via the Cloud?

Hi,

Is there a limit on the amount of variables that can be read via the SparkCloud? I can read 4 variables without problems but when add a fifth variable then I see a lot a errors (timeouts on protocol level) and the SparkCore resetting (CFoD, although it will come back with the latest core-firmware release :-)).

EDIT: I forgot to mention that the variables are read shortly after each other every 5th second.

Thanks,
Henk

Hi @nika8991 - yes there is a limit of four variables, but this isn’t a limit imposed by the Cloud, but rather the Core (it’s a way to reduce the memory overhead).

Hi @zach, thanks for the clear answer.
One more question, is there a limit on the string length that can be returned as variable?
Br.,
Henk

Two things:

  • The limit on the number of Spark.variables is currently ten, set here: https://github.com/spark/core-firmware/blob/master/inc/spark_utilities.h#L43 I just tested that I could create 5 variables without issue. I suspect your 5th variable is a string…
  • There is a bug that we’ve got in our backlog with strings as Spark.variables—they do not currently work AFAIK. I just spent a little time looking over the code and saw no immediate problems. I’ve asked @satishgn to dig into it this week.

Hi @zachary, here my findings.
When I tried to get 4 integer variables and 1 string variable I got a lot of timeouts, the string is indeed the 5th variable.
After I changed that into 3 integers and 1 string (again at the end) the SparkCore was stable and I was able the get the correct integer and string values.

Br.,
Henk

1 Like

Thanks @zachary, I was trying to figure out why my string cloud variables were not all working. I found that my first String variable works all the time. however a 2nd String variable never works - it always produced a ‘time-out’. I have 4 other INTEGERS that seem to work. I have not tried 3 String variables.

Interesting - we’ll have to take a look at that, I’ll add it to the backlog.

I’m out-of-office-ish right now, but I think I saw a pull request to fix this related to a hard-coded packet length rather than testing strlen() to determine length. Most likely a fix is coming soon to a web IDE near you!

I can confirm that the variable string length fix was merged into the build branch and is live – you can now safely return strings up to about 230 chars in length. :smile:

2 Likes