espruino / Espruino

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

Bangle.js 2: Compass z value constant #2332

Closed nxdefiant closed 1 year ago

nxdefiant commented 1 year ago

I was wondering why the Compass on my Bangle.js 2, firmware 2v16.11 gives only two different values no matter the orientation:

>Bangle.getCompass().z
=257
>Bangle.getCompass().z
=514

and I found an odd statement in jswrap_bangle.c#L1208

I assume (without having read the datasheet) it should read offset 5 & 6, not 5 & 5: mag.z = buf[6] | (buf[5]<<8);

gfwilliams commented 1 year ago

Wow, good spot - thanks! I guess I tested x/y because that's what is used for heading, but not Z - I'll get that fixed