Regulating time of Bangle.js 2

Posted on
Page
of 2
/ 2
Next
  • There are four ways I know of to regulate the watch’s time:

    1) from the app loader download a watch script a few times a day. Not a great solution.
    2) sync to an iPhone. Probably tricky, and I don’t know enough to do that. I don't have Android.
    3) sync to GPS time. I have tried code that doesn’t seem to work.
    4) slow down the watch by about 35 ms every 10 minutes, those numbers being adjustable.

    For 4) is there a function I can try for slowing by 35 ms repeatedly? I understand setTimeout for calling a function every 10 minutes, but not much more about javascript. I’m not a coder. (My Dozenal Time watch was coded by someone who left the project. Possibly the way it gets the time is not standard.)

  • 4) is not possible that accurately.

    Bangle.js 2 can only set time with one second accuracy but with following trick you can get more accuracy: If current time is e.g. x.3 seconds then wait 700 ms and set time to x+1 seconds. This is somewhat accurate, but the problem is that accuracy varies a bit and after setting time you want to check again how much clock is off becuase it will have changed.

    5) keep offset, slowing down shown time, not actual watch time

    More accurate solution is to not set watch time but instead keep an offset of how much clock is off and apply that offset to shown time, i.e. don't show actual watch time but time-offset. That 35ms (or whatever) every 10 minutes would then be just added to offset. Unfortunately this would require each app to keep track of that offset.

    Hybrid solution is also possible, e.g. one app keeps offset and if offset is over e.g. 300 ms then it changes watch time so other apps will also have correct time.

    ps. That 35ms (or whatever) also depends on temperature. If you wear watch on wrist all the time it's not that significant, but if you e.g. like to wear watch over the clothing in winter then temperature should also be taken into account.

  • Temperature no problem, high accuracy not needed. I'd settle for altering shown time only as an improvement over the situation without it.

    Probably doing something every 10 minutes will use too much power, so a longer interval will be better. I suppose I have to find how my script gets the time and then alter that (maybe every three hours).

  • for 3.) - what did not work?

  • I'd have to reprint a lot of code (written by someone else). Do you have something that works?

  • №2 it's simple:
    a) Download the free app Connect Browser (minimal webBLE enabled browser for iPhone)
    b) Open in this app https://banglejs.com/apps/
    c) Connect an iPhone to it
    d) Click the 'More...' tab and set ON the switch: Always update time when we connect

    Done :)

  • Interesting, thanks.

    If it always updates time "when we connect," must the watch be disconnected and reconnected in order to keep using the phone's time?

  • See reply above.

  • Yes, it looks like you need to reconnect your watch to the app to correct the time.

  • Thanks for clarifying. Unfortunately that's only a little better than reconnecting to the Internet any other way. It's a manual necessity. Maybe an app that would disconnect and reconnect at specified intervals automatically? That would do it.

    We need a way to get iPhones to send their time (at certain intervals) to the Bangle without intervention. One way has been discussed elsewhere but currently seems difficult and possibly also awkward, and I can't determine how well it works.

    Connect Browser has a tendency either not to find the watch or to freeze it )-:

  • Is there a GPS use that will work? Including indoors after the fix, of course.

  • After fix? I would update the time on fix..

  • I'm a novice at this. After getting a satellite's GPS fix outdoors, what's next? There needs to be code inserted into a watch's script to use the GPS time, correct? I may be missing something…what's the procedure to get the watch to use GPS time, and does it work?

  • Aah now I see. Someone should update the GPS auto time Widget to work with the Bangle2

  • Does that work (with Bangle.js 1) indoors? Independently of the watch's built-in timing? What updating does it need, do you think, to work with watch 2?

  • It works when you get GPS fix - I doubt you can get fix indoors.

    According to documentation that should work in Bangle.js 2 - that event says it's available on "Bangle.js smartwatches"

  • GPS obviously needs an outdoor fix. Once the fix is lost, so is the time.
    Is there a documentation to port a BangleJS1 widget to V2?

  • Meanwhile, to clarify: you get the fix, the Bangle takes up GPS time outside (via a widget or via inserted code), and you walk indoors. What is the watch timing doing after that? Sorry to ask, but I don't know the explicit answer.

    If using GPS time is possible only outdoors, it's of limited use, obviously.

  • That widget works so that when you get GPS fix it copies time from GPS to Bangle.js clock.

    When you go inside GPS would lose time but Bangle.js clock continues normally with usual clock drift (e.g. that 35 ms/10 min mentioned earlier).

  • Have you done anything to correct the drift you and I have noticed?

  • For my test clock I'm currently using the option 5) I mentioned in 2nd message in this thread.

  • Got any specifics? I can try to do an offset, say 630 ms every 3 hours for starters, if I can understand my watch's code. Or is there a generic way to do that?

    Have you had success?

  • Well my actual code is more complex but the basic idea is this:

    setInterval(function() {
      // adjust by 630 milliseconds
      let adjusted_time = Date.now() - 630;
    
      let delay = 1000 - (adjusted_time % 1000);
      setTimeout(function() {
        setTime((adjusted_time + delay) / 1000);
      }, delay);
    
      // adjust every 3 hours
    }, 3 * 60 * 60 * 1000);
    

    Every 3 hours:

    1. get current watch time
    2. calculate adjusted time
    3. calculate delay until adjusted time is exact second
    4. wait that delay and then set watch time in seconds

    Only one running app must do this or else there will be too much adjustment. I'm currently using code like this in my clock app, but it would be best if it were run in a widget (however I havn't yet learned how to make widgets).

  • I'd like to try that. Is there an output result (i.e. a word) that needs to be inserted into my watch's code as input after running that? Or if I preface my code with yours, is that all that's necessary?

  • It should work if you just add that code at beginning of any watch code.

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

Regulating time of Bangle.js 2

Posted by Avatar for Numerist @Numerist

Actions