I think you're using 4 backticks where you only need 3, which is what messes with the formatter.
The micro ECC one isn't related. What happens is:
newSteps = stepcount_new(accMagSquared); at https://github.com/espruino/Espruino/blob/fc2d816c57bd36da89972aa39775ba03c3d591a5/libs/banglejs/jswrap_bangle.c#L1099
newSteps = stepcount_new(accMagSquared);
and accMagSquared = acc.x*acc.x + acc.y*acc.y + acc.z*acc.z; where the acceleration values are the raw ones from the sensor, where 1g = 8192
accMagSquared = acc.x*acc.x + acc.y*acc.y + acc.z*acc.z;
The test harness should be the same: https://github.com/gfwilliams/step-count/blob/master/main.c#L77-L87
The int32_sqrt is defined inside stepcount.c: https://github.com/espruino/Espruino/blob/fc2d816c57bd36da89972aa39775ba03c3d591a5/libs/misc/stepcount.c#L156
so it should be identical between calls
@Gordon started
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.
I think you're using 4 backticks where you only need 3, which is what messes with the formatter.
The micro ECC one isn't related. What happens is:
newSteps = stepcount_new(accMagSquared);
at https://github.com/espruino/Espruino/blob/fc2d816c57bd36da89972aa39775ba03c3d591a5/libs/banglejs/jswrap_bangle.c#L1099and
accMagSquared = acc.x*acc.x + acc.y*acc.y + acc.z*acc.z;
where the acceleration values are the raw ones from the sensor, where 1g = 8192The test harness should be the same: https://github.com/gfwilliams/step-count/blob/master/main.c#L77-L87
The int32_sqrt is defined inside stepcount.c: https://github.com/espruino/Espruino/blob/fc2d816c57bd36da89972aa39775ba03c3d591a5/libs/misc/stepcount.c#L156
so it should be identical between calls