You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • No this is not the case.

    I'm not entirely sure you got my point about this. You set up peak after accFiltered=0, so
    when gate_open=true, peak is full of zeros and if the next sample is less than the first you get something like 0,20,19 in peak and that is enough to register as a step.

    If you got rid of if (!gate_open) accFiltered = 0; and instead just had gate_open && peak[1] > peak[0] && peak[1] > peak[2] && accFiltered > stepCounterThreshold you wouldn't have the issue.

    JS test harness would be good, but I guess if we have all the data, we already have a working test harness in https://github.com/gfwilliams/step-count that uses the actual C code from Bangle.js, so long-term it feels safer to use than than to maintain two different step counters - one in JS and one in C

About

Avatar for Gordon @Gordon started