You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Comments on the PR at https://github.com/espruino/Espruino/pul­l/2264 but I just added the code mentioned above as a library: https://github.com/espruino/BangleApps/c­ommit/ff9a5c4c20bc95fd0d628bd7041f71753a­1edf6c

    I made it so it returns a promise, because I think there's a good chance that the code will need changing and may need to do some things (like waiting for an HRM reading) that don't return immediately.

    I think there is a potential for the library to emit a 'worn' event as well (which probably makes a lot of sense) but I imagine @splch is thinking that in cases like alarms they might want to just check instantaneously at the point they were thinking of making a noise.

    In terms of the checks, I think a few things would need improving:

    • as @Ganblejs says, temperature may end up being too low
    • Checking Bangle.getAccel().mag once is unlikely to be a good way to check movement, since it checks movement only over a 1/12.5 sec period. You probably want Bangle.getHealthStatus().movement (see http://www.espruino.com/Reference#l_Bang­le_getHealthStatus) but again, this works in 10 minute blocks, so some work probably needs to be done (maybe checking Bangle.getHealthStatus('day').movement once every 10 seconds and comparing?) to ensure that you check the full amount of movement over a period of a few seconds
About

Avatar for Gordon @Gordon started