You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just to say I'd always recommend using the event rather than polling.

    While in reality there may not be a big difference in power usage, if you're polling you risk getting the same reading twice (or skipping one) if there's a minor difference in timing between the accelerometer and the interval.

    Also, it looks to me like calc_ess does some things in pure JS that Espruino already provides utility functions for. E.sum and E.variance should do what's needed on the ess_values array really quickly.

    There is now the health event every 10 minutes which has a 'movement' field too, and it's possible that could be used instead with basically zero extra calculation needed.

About

Avatar for Gordon @Gordon started