I think we need a javascript implementation that people can tweak.
Well, I did spend time doing that 2 months ago, but then nobody bothered to do anything with it!
For developing, absolutely - but in the end we need it baked into the firmware or it'll kill battery life.
Your JS version looks good though. I think it's possible that just raising stepCounterThreshold to maybe 1500, lowering STEPCOUNTERHISTORY to 2 and STEPCOUNTERHISTORY_TIME to 40ish might actually have a pretty good effect.
The accelerometer regularity should be absolutely fine unless you have an app/clock that's blocking execution for more than around 100ms - in which case you could end up with some duplicated samples.
In terms of sample rate - we're currently 200% out - so I don't think that is our main problem. If we increase the sample rate then that drains battery quicker (especially if we're processing in JS) and does cause some issues in other areas, so I'd rather not do it unless it turns out to be absolutely required. You can however tweak it yourself from JS if you want to try: https://github.com/espruino/BangleApps/blob/master/apps/accelrec/app.js#L35-L38
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.
Well, I did spend time doing that 2 months ago, but then nobody bothered to do anything with it!
For developing, absolutely - but in the end we need it baked into the firmware or it'll kill battery life.
Your JS version looks good though. I think it's possible that just raising stepCounterThreshold to maybe 1500, lowering STEPCOUNTERHISTORY to 2 and STEPCOUNTERHISTORY_TIME to 40ish might actually have a pretty good effect.
The accelerometer regularity should be absolutely fine unless you have an app/clock that's blocking execution for more than around 100ms - in which case you could end up with some duplicated samples.
In terms of sample rate - we're currently 200% out - so I don't think that is our main problem. If we increase the sample rate then that drains battery quicker (especially if we're processing in JS) and does cause some issues in other areas, so I'd rather not do it unless it turns out to be absolutely required. You can however tweak it yourself from JS if you want to try: https://github.com/espruino/BangleApps/blob/master/apps/accelrec/app.js#L35-L38