We should really be doing the same stuff in the test harness.
Yes - need to be the same so we can do predicatble modelling that will match the real world measures when actually walking with the device etc.
I was not sure if the accelerometer chip does the calculation for magnitude OR the firmware does it. In the test harness I can see the In32_sqrt() function. Is this the same in the Bangle firmware. Was not sure where to look in the code.
Not really sure how this compares to:
Espruino/libs/misc/stepcount.c
// quick integer square root
// https://stackoverflow.com/questions/31117497/fastest-integer-square-root-in-the-least-amount-of-instructions
unsigned short int int_sqrt32(unsigned int x) {
unsigned short int res=0;
unsigned short int add= 0x8000;
int i;
for(i=0;i<16;i++) {
unsigned short int temp=res | add;
unsigned int g2=temp*temp;
if (x>=g2)
res=temp;
add>>=1;
}
return res;
}
Apologies I think * is confusing the code formatter
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.
Yes Magnitude.
Yes - need to be the same so we can do predicatble modelling that will match the real world measures when actually walking with the device etc.
I was not sure if the accelerometer chip does the calculation for magnitude OR the firmware does it. In the test harness I can see the In32_sqrt() function. Is this the same in the Bangle firmware. Was not sure where to look in the code.
Found this in ./libs/banglejs/jswrap_bangle.c
Found this in
./targetlibs/nrf5x_15/external/micro-ecc/curve-specific.inc
Not really sure how this compares to:
Espruino/libs/misc/stepcount.c
Apologies I think * is confusing the code formatter