espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.78k stars 746 forks source link

Module MPR121 failing with example script - Function "readword" not found - executing mpr.touched() #2259

Closed SimonGAndrews closed 2 years ago

SimonGAndrews commented 2 years ago

image The above script is failing on an Espruino MDBT42Q with the error: image

Looks like prop. an error introduced in the last last change of module MRP121, last May.

SimonGAndrews commented 2 years ago

Changing the references to the functions in the object MPR , in the module, from this.readword() to to MPR.readword fixes the issue in a local copy of the module. As in the following.

image

Thanks in advance for your help with this issue. Im happy to test after a change if it helps. R Simon

mariusGundersen commented 2 years ago

Seems like the module was changed to use the arrow function syntae, that doesn't work with this. Since you are using the latest firmware version you can also/instead change it to

...
touched() {
  return this.readWord(0);
}
... 
gfwilliams commented 2 years ago

Argh, sorry - not sure how that happened.

I've just sorted this out, and it'll go live next time I update the website, which should be this week