@allObjects thanks for your help with this. So what was the actual problem at the end of all this?
Could we roll it into a fix for the module on github?
Using the numeric value in GAINS rather than a non-numeric is intentional, because it then uses a lot less memory (both parts should fit in one JsVar). The !(gain in GAINS) test should still work as well - I just tested - so I'm not quite sure which change actually fixed this?
Also, you mention using the CONFIG object, but it's actually carefully arranged such that the minifier is able to totally remove it... So the nonminified version remains easy to edit, while the minified version is really compact.
If you were to access CONFIG like CONFIG["PGA_" + this.gain + "mV"] then I'm pretty sure the minified code would end up an awful lot bigger.
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.
@allObjects thanks for your help with this. So what was the actual problem at the end of all this?
Could we roll it into a fix for the module on github?
Using the numeric value in
GAINS
rather than a non-numeric is intentional, because it then uses a lot less memory (both parts should fit in one JsVar). The!(gain in GAINS)
test should still work as well - I just tested - so I'm not quite sure which change actually fixed this?Also, you mention using the
CONFIG
object, but it's actually carefully arranged such that the minifier is able to totally remove it... So the nonminified version remains easy to edit, while the minified version is really compact.If you were to access
CONFIG
likeCONFIG["PGA_" + this.gain + "mV"]
then I'm pretty sure the minified code would end up an awful lot bigger.