I just recently bought my Particle Photon and I am loving it so far! However reading through the documentation I saw that you can only register up to 4 web functions and 10 web variables. With that being said I was wondering if that is a cloud limitation or if it is a hardware / device firmware limitation. I am just wondering because I wanted to hack on it, but did not want to go off on a wild goose chase.
Since no one who actually knows the answer has chimed in yet, I’ll throw in a “probably not, but even if you could, you shouldn’t."
In the very least you’ll need to get all of the firmware open source, the gcc-arm toolchain and other dependencies. It’s a fun exercise if you’re into that sort of thing, but it’s not exactly easy.
Even if you got it to work, you’d then no longer be able to use the Particle Build (Web IDE), Particle Dev (Atom IDE) or CLI cloud compile, because your changes would keep falling out. The only way you could build code would be to use the local gcc-arm toolchain and USB dfi-util flash tool. Well, you could build a binary locally then cloud flash with Particle CLI, but it’s still a multi-step process.
If you need more functions, use a single function and specify which one you really want in the parameter data passed to the function.
If you need more variables, you’re probably better off bundling a bunch of variables together into a single one and encoding them in some sort of text format like comma-separated values or JSON or something like that, but keep in mind the length limitation (622 bytes).
Yeah I did not expect it to be a super easy process. I found the header files and c++ files that have to do with the cloud and I am reading over them. Ill probably toy around with it and try to build my own version of the firmware just for some fun.
I also thought about using a function then passing in the function and its parameters, but it just seemed like kind of a cringy idea to me.
I believe you’re looking at old code - the 0.4.x firmware supports an unbounded number of functions and variables. (The upper limit is determined by how many of these can be contained in a single message to the cloud.)
Oh, Interesting. Is the repo not updated then or is that code in place for legacy? I was just wondering because the documentation on the core needs to be updated then. With that being said with the new system what is the max message size? This question is just me wondering so I know for the future.
Edit: 600 bytes is the upper limit to the message. Just incase anyone comes across this.