Meowbit z value inverted in MakeCode

The Meowbit’s z value is inverted in MakeCode Arcade Programs. If the device is lying flat (has to be supported as the battery bulge means it doesn’t want to) then the z value for mine is 1067. I would expect around -1000 (note negative) to match the simulator and the PyGamer. This is on 0.13.22 5.19.9. Where does the fault lie here? Does the bootloader have any influence on this?

On a more trivial note, the acceleration (mg) block says:

Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1023)

If these are mg then I would expect that to read z=-1000 for standard gravity? -1023 looks more like a value inspired by an irrelevant, symmetric range limitation on an 11bit signed integer?

I’ve been using this simple code to check the values:


I’m using @AlexK’s very useful pxt-arcade-display-strings extension in there, thanks for that.

Would be great to get to get GH: microsoft/pxt-arcade: Simulator tilt is visually incorrect in MakeCode Arcade Beta. #1211 fixed too. That’s very confusing.

We currently don’t have a bootloader config key for this but we should. The Z should be easy since the accelerometer chip is on the back of all boards we have so far.

Will take a look on Monday.

What is the significance of a “bootloader config key”?

I’ve also noticed the on blocks for accelerometer don’t work on the Meowbit: GH: microsoft/pxt-arcade Accelerometer event blocks from controller extension on Meowbit do not work #1216

Technical details about bootloader config are here:

Essentially, the bootloader contains configuration data for the MakeCode runtime (and possibly other runtimes). We don’t actually use any code from the bootloader when the application is running, so it’s not exactly drivers.

Anyways, the runtime currently doesn’t allow changing of the accelerometer reference frame, based on bootloader config keys but we should, and will, add it.