New App / Widget: Chrono Widget

Posted on
  • I wanted to have a timer which does not need an app to be opened to run.
    So I created a widget.
    Have fun with it and provide feedback :)

    https://github.com/espruino/BangleApps/t­ree/master/apps/chronowid

  • That is interesting, so using this widget, can I make an drink water reminder app?

  • Sure. All this is based on dates (including time) written to a file.
    Basically, you set the timer to one hour, then the goal time is now+1h.
    When the widget is loaded, the target time is read again and compared to now. If the difference is <= 0 you get an alert. Only thing is that the widget has to be running to alert. But it does not have to run the whole time, like a timer app.

    You could create a setting where reminders should start and write that to the file.
    Then after a certain time alert and write the next alerting time to the file.

  • @Purple-Tentacle Chrono Widget seems to break things on firmware v2.05.440. Tested it on a clean install of the default apps, and installing Chrono Widget just makes the screen go black. Any app showing the widgets seems to be affected.

  • Okay, strange.
    I will take a look at it tomorrow. Could you see some errors ins the IDE?
    Would be really helpful.

  • Oh yeah... Forgot to check that:

    BLE Connected, queueing BLE restart for later
    {"t":"status","bat":76}
    Uncaught ReferenceError: "x" is not defined
     at line 2 col 102
    ...r.c)g.clearRect(0,h-24,w-1,x,h-1);for­(wd of WIDGETS)wd.draw(...
                                  ^
    in function called from line 118 col 20
    Bangle.drawWidgets();
                       ^
    at line 36 col 16
      eval(clockApp);
                   ^
    > 
    

    Weird...

  • This does not come from Cbrono Widget. Strange.

    g.clearRect(0,h-24,w-1,x,h-1);
    

    Normally it is (xstart,ystart,xend,yend). There is another 5th variable?

  • Yeah, that's what I figured as well. Couldn't see that in your code anywhere.

    That error pops up regardless if the watch has just been cleared with "Install Default Apps" or if I've already set it up with my favourites.

    Seems like the widget is triggering something, somewhere.

  • Ok, same happens for me with firmware v2.05.440.
    When LCD times out, the clock loads though.

    Lets see why this happens.

  • I only had the widgets load in after the LCD times out, no clock...

  • I changed the widget position from bottom left to top left and now it is working.
    @Gordon are widgets at the bottom line not supported?

    WIDGETS["chronowid"]={area:"bl",width:wi­dth,draw:draw,reload:function()
    WIDGETS["chronowid"]={area:"tl",width:wi­dth,draw:draw,reload:function()
    
  • Oh... I really liked that positioning of the widget. Would be sad if it doesn't work.

  • Argh! Sorry, looks like a typo in Bangle.drawWidgets in the newer (post-KickStarter) firmwares.

    If you try a build from http://www.espruino.com/binaries/travis/­master/ in a few minutes, it should now be fixed

  • Confirmed fixed in v2.05.441.

  • @Purple-Tentacle One observation: The buzz doesn't go off when the timer reaches zero, but rather one second after when END is displayed. In other words, a 10 second timer becomes an 11 second timer...

    Edit: and maybe a reset option in the app? To set everything back to zero.

  • Confirmed fixed in v2.05.441.

    And in v2.05.442.

  • The buzz doesn't go off when the timer reaches zero, but rather one second after when END is displayed. In other words, a 10 second timer becomes an 11 second timer...

    Yes, that is because I am checking only for full seconds, not ms.
    Before the differnec between now and goal time had to be <=0. If you start the timer at 11:00:00:0500 it would only buzz when an additional second has passed, so at 11:00:01:0500.

    I changed it so that it now alerts when difference is < 1000, so it alerts at the right second (500 ms left is <1000).

    Advantage: buzzes when 00:00 is shown.
    Drawback: now it may alerts too early:
    Goal: 11:00:00:0001
    Timer: 10 seconds
    Planned alert: 11:00:10:0001
    Actual alert at 11:00:09:0002 because diff is <1000.

    But this is an extreme case and I could live that.

    Nevertheless, I added the following note to the readme file.
    Depending on when you start the timer, it may alert up to 0,999 seconds early. This is because it checks only for full seconds. When there is less than one seconds left, it buzzes. This cannot be avoided without checking more than every second, which I would like to avoid.

    maybe a reset option in the app? To set everything back to zero.

    Good idea, will do that.

  • 0.02 released
    Now buzzes at 00:00 and there is an option to reset the values.

  • Works great!

  • I made a bugfix. Normally only 00:00 (minutes:seconds) should de displayed, when less than 1 hour is left. But I miscalculated the milliseconds.
    Fixed in https://github.com/espruino/BangleApps/p­ull/330

  • Hm. Why is in the travis master no bangle.js build file? The older build directories look completly different.

  • @Tx: 2.05.442 is here: http://www.espruino.com/binaries/travis/­daec4c2ece1cdc52f8784a361b9e48991cf5e78d­/
    All later builds seem to be some different version. Also currently the bangle build is failing....

  • The version number change is due to the actual 2v05 release. Things ended up getting a bit messed up because I did a 2v05 release for KickStarter Bangles before everything else.

    The lack of current build seems to be due to a Travis issue I'm afraid. Sometimes the build systems just don't pull in all the required files. Next update (soon I imagine) will cause a new build which will fix it

  • @Gordon: So the "bleeding Edge" is currently http://www.espruino.com/binaries/travis/­c998d8b6f9d81fa02bcb8765b4203a0e369110f8­/ with espruino_2v05.17_banglejs.zip ?

  • Right now, yes.

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

New App / Widget: Chrono Widget

Posted by Avatar for Purple-Tentacle @Purple-Tentacle

Actions