Avatar for storm64


Member since Jan 2022 • Last active Jan 2024
  • 0 conversations

Most recent activity

  • in Bangle.js
    Avatar for storm64

    Maybe I have something that suits your needs:
    I wrote a little helper function to get only the isWearing value from HRM-raw.

    Here a little example:

          (isWearingStatus, messages) => { print(messages[isWearingStatus ? 1 : 0]); },
            "You are not wearing the watch.",
            "Yor watch is on your wrist or on a surface that appears similar."

    The return function is called with the isWearing-status as first and the passed data as second argument: returnFn(isWearing, data);

    Here the code of this function:

        // define function to check if the bangle is worn by using the hrm
        function checkIsWearing(returnFn, data) {
          // create a temporary object to store data and functions
          global.tmpWearingCheck = {
            // define temporary hrm listener function to read the wearing status
            hrmListener: hrm => tmpWearingCheck.isWearing = hrm.isWearing,
            // set default wearing status
            isWearing: false,
          // enable HRM
          Bangle.setHRMPower(true, "wearingCheck");
          // wait until HRM is initialised
          setTimeout((returnFn, data) => {
            // add HRM listener
            Bangle.on('HRM-raw', tmpWearingCheck.hrmListener);
            // wait for two cycles (HRM working on 60Hz)
            setTimeout((returnFn, data) => {
              // remove listener and disable HRM
              Bangle.removeListener('HRM-raw', tmpWearingCheck.hrmListener);
              Bangle.setHRMPower(false, "wearingCheck");
              // cache wearing status
              var isWearing = tmpWearingCheck.isWearing;
              // clear temporary object
              delete global.tmpWearingCheck;
              // call return function with status
              returnFn(isWearing, data);
            }, 34, returnFn, data);
          }, 2500, returnFn, data);

    I am using this in the 0.10+ version of sleeplog:

  • in Bangle.js
    Avatar for storm64

    I tried it several times but sleep log only works if worn on the right wrist (Bangle 2). On left wrist it always detects no sleep. I did not change any settings yet. Do you have any ideas?

    This a really interesting occurrence. I am right-handed and always wear my watch on the left wrist. This is how I tested the app and set the default values. I never tried to check how the data changes on the other wrist.

    Actually I'm working a lot on the app and there will be some major changes and improvements on the next version. For more detailed information you may take a look on this issue in github.

    For a faster solution I would recommend to try the power saving mode. Over my test I experienced a quiet similar behavior in both modes but the hardware varieties might be less noticeable. As a result, you might not need to change the default values for the power saving mode.

  • in Bangle.js
    Avatar for storm64

    I would love to have all files belonging to an app inside its own folder.
    I think it will also make it easier to fetch the upstream on a repository with added apps.