Improved pedometer widget

Posted on
of 2
/ 2
  • Still work in progress, but I want to get it out in the wild for you to test and to receive feedback.
    I am still testing with the settings, but I am 90% satisfied.

    The goal was to filter out arm movement, but to still count real steps.
    Please see the readme for details.


    • Good readability
    • Arm movement filtering
    • Step goal display
    • 'Active' display


    • Uses a lot of memory, but I am sure this can be improved by a real developer (so not me)
    • Uses a lot of screen space, but this is needed for readability
  • I just did a test walk. Two things have to be done

    • Widget is redrawing constantly and BTN 2 does not react an<more, no menu opens. Something big is wrong.
    • Instead of 10.000 steps it counted only 6.400

    Lets see why the steps were not counted and what is happening in the widget.

  • I redesigned the whole logic and will do some further tests.

  • Just provided a small update.
    Readme shows changes made in new algorithm.

    Now every step is counted when in status 'active', if the time difference between two steps is not too short or too long.
    To get in 'active' mode, you have to reach the step threshold before the active timer runs out.
    When you reach the step threshold, the steps needed to reach the threshold are counted as well.

  • Tested it yesterday and the steps on the walk were counted very good. It filters a lot of arm movement, there has to be a lot to get in active mode.

    Drawback is, that very small walks in the house are not counted. Not much I can do about it, without counting arm movement again.

  • I created a pull request to the Bangle.js app loader:­ull/290

  • Will for sure give it a try and let you know how it worked.

  • Suggestion: show kilometers instead on steps with that bigger (green/white) font. Make step size configurable.

  • Thanks for the suggestion.

    I would like to keep the steps displayed for now. Maybe make it configurable in the future?
    So that you could chose what ti display in each line, steps or distance.

  • Tested it for a quick walk (3.5k steps) right now and it seems to work pretty well.

    How about an option to reset the steps?

  • Yes, this would be handy, I will implement it. Thanks.

  • Awesome!

    By the way, some explanation of the available settings in the readme might be a good idea as well.

  • I already updated the readme. Will be in the next PR.

  • I already implemented distance calculation on my dev repo. Only in km for now.
    You can chose what to display in each line, steps or distance.

    The widget takes too much memory now, it is not even possible to go to the settings app without running into memory problems. I will need someone to assist me with this.
    I am going to open an issue now for that.

    Edit: there it is­ssues/296

  • Only in km for now.

    If you feed that into require("locale").distance(...) it should format it for you nicely :)­e

  • But that would only help for the unit (km/mi etc.) and not the calculation, right?

  • But that would only help for the unit (km/mi etc.) and not the calculation, right?

    Nope, it does the calculations for you magically. Just give it the distance in meters and you're sorted :)

  • Sounds nice and works.
    But I have problems with that.

    When distance is in the second line (small font) I want to display 1,252km
    3 digits + unit

    When distance is in the first line (large font) I want to display 1,25
    2 digits, no unit.

    AFAIK this is not possible with locale?


  • AFAIK this is not possible with locale?

    No, but if you could use a regex/similar to strip it down? Eg "1,252km".replace(/[^0-9,\.]+/,"") - It's pretty handy for those in non-km countries to be able to have stuff in the right units.

  • What do you think about a notification when the daily goal is reached?

  • What do you think about a notification when the daily goal is reached?

    That is a good idea, I will look into it.

  • Is there a quick way to delete all recorded data? Even better: delete all recorded data older than a given age.

  • about step counting, if you want to take a lower level approach and embed it into the firmware, this is open source and validated:­-Step-Counter

    There are some constants that need to be optimised because they depend on the actual hardware you use and the sampling frequency (we used 50Hz, but probably 10Hz would do anyway). See the instructions in the README. If anyone here wants to try including this in the BangleJS firmware, I'll be happy to help.

  • I feel dumb asking this but I'm totally new to Banglejs and coding in general. I'm tasked with creating a watch face, I figured that out on my own, and then also adding the pedometer widget. I can't seem to figure out how to correctly place the code, would someone be willing to show me the coding for this widget in the IDE? Thank you!

  • @user129103 Don't understand your question, so can't help you.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Improved pedometer widget

Posted by Avatar for Purple-Tentacle @Purple-Tentacle