Gesture on Bangle JS 2

Posted on
  • Hi @Gordon, I would like to ask you more clarification on how the movement gesture feature of the Bangle JS 2 is working. What are the events that trigger the start and stop of a gesture? What measurement are they based on (accelerometer magnitude? Difference in acceleration compared to the previous data point?)?

    Moreover, I would like to know more about the Bangle.setOption parameters related to movement gesture. In the software reference I found these 4:

    1. gestureStartThresh: how big a difference before we consider a gesture started? default = sqr(800)
    2. gestureEndThresh: how small a difference before we consider a gesture ended? default = sqr(2000)
    3. gestureInactiveCount: how many samples do we keep after a gesture has ended? default = 4
    4. gestureMinLength: how many samples must a gesture have before we notify about it? default = 10

    In this vein, "sqr" stands for "square root"? The values of "800" and "2000" to what kind of measure do they refer?

    I tryed to change these parameters both on the Bangle ide and inside an app that I built, but everytime that I touch these option the gesture functionality stops working. Even setting back the old parameters don't fix the situation, so I have to completely reset the watch everytime. After completely resetting the watch, without touching the parameters, the gesture functionality works again correctly. Could it be a bug or maybe I'm doing something wrong?

    Thanks in advance :)

  • The best thing really is to check the code at https://github.com/espruino/Espruino/blo­b/master/libs/banglejs/jswrap_bangle.c#L­1638 but...

    Difference in acceleration compared to the previous data point?)?

    Yes, it's this. It's the difference in raw acceleration values.

    The sqr stands for squared - it might be worth checking with Bangle.getOptions to see what the values are originally, but gestureStartThresh should have a default of 800*800. (I can't remember now why we square them and don't use them normally, but I think it's historical)

    Chances are it broke because the value was 800*800 and you set it to 800?

    So:

    • gesture starts when accDiff > gestureStartThresh
    • gesture ends when accDiff < gestureEndThresh for at least gestureInactiveCount samples
    • if there are less than gestureMinLength samples we ignore it
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Gesture on Bangle JS 2

Posted by Avatar for franzdigru @franzdigru

Actions