Thanks for the explanation, so it's expected and by design?
But that means, that a couple of libraries that support optional pins, just "accidentally" work? IIRC in most cases the check is usually if(options.whateverPin){...}
For example in the CCS811, it's
if (ccs.options.int) {
...
Thinking back, I may have had an issue with A0 on the Pixl, but just moved to another pin without thinking too much. Or maybe not :)
Consistency with JS I think usually would be beneficial, for example setting the length of an array in a browser empties that array. But creates a length property with value of 0 in Espruino :)
Don't know how much work would be to add a special handling from Pin to bool.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks for the explanation, so it's expected and by design?
But that means, that a couple of libraries that support optional pins, just "accidentally" work? IIRC in most cases the check is usually
if(options.whateverPin){...}
For example in the CCS811, it's
Thinking back, I may have had an issue with A0 on the Pixl, but just moved to another pin without thinking too much. Or maybe not :)
Consistency with JS I think usually would be beneficial, for example setting the length of an array in a browser empties that array. But creates a
length
property with value of0
in Espruino :)Don't know how much work would be to add a special handling from
Pin
tobool
.