I’m using multiple Particle Photons with same firmware and same code. Unfortunately one Photon is returning confusing return values for all cloud functions.
We are having a similar issue where our firmware which had been working on Device OS Firmware Version #0.6.3 on Particle Photon P1 boards for about a year, suddenly started to report garbage values for the debug functions being run from the cloud. We checked hardware, bussing and schematics and other possible causes and eventually upgraded to 0.7 to see if that fixed the issue, which it did.
We have observed that 0.6.3 is breaking cloud based particle call functions for some photon P1 chips, but not all of them.
Can support please provide some guidance as to what might be the underlying issue?
For one, we are at 1.4.3 now - 0.7.0 is still ancient and bugs are bugs with little benefit in trying to explain now what went wrong years ago. The change logs of the transition from 0.6.3 to 0.7.0 may already hold that info.
And for your error report it would be better to explicitly state what garbage you receive, what value you expected, how you obtain the return value, whether you have checked via console.particle.io and finally how your function looks that should return the value.
and yes I agree, I can/should/will look into the change logs documents today, and I was just hoping, if someone had an answer for after I am done with my research today…but you are too fast.
Our Aim/Current Program: detects presence of 3 water level sensors and turns on specific bits (Left 3 MSB’s) of a 8 bit number and returns this number as a int.
On the firmware side trying to debug -
We first verified the presence of integer values on I2C bus via logic analyzer, which confirmed.
Then, we looked at console/serial terminal and we see the right values just before they are sent. ( What we expect on cloud/see on terminal window is a value of WaterLevelSensor when it detects sensor 1 is 32, sensor 2 is 64, and sensor 3 is 128, just before the data is packaged for sending.
what we see being returned from the exposed cloud functions are big numbers 537001984, 134231873, 134226285.
If you do that via type casting this may not work (e.g. for Particle.variable()). It would be good to see how that "as a int" is implemented in your code.
When you know your value will only ever feature three significant bits you can always use x & 0x03L to mask out any extra bits.