clock_info - support

Posted on
Page
of 3
/ 3
Last Next
  • I see there is a new module called clock_info but am wondering which clocks support this ?
    I'm curious to see how this works in practice at a UI level.
    I ideally want to try out a few example clocks.
    Cant find any documentation on it other than the clock_info module.

  • BW Clock, Linux Clock, and Circles Clock so far I think.

    Here are some PRs made regarding clock_info.

  • And Slope Clock ++

    Cant find any documentation on it other than the clock_info module.

    There's a tutorial on it now: http://www.espruino.com/Bangle.js+Clock+­Info

  • Thanks. So the idea is that the user can install any number of clock info modules and any clock that supports the clock infos will get the new feature added ? Excellent idea. I very much like the concept.

    Had a bit of trouble with it though. I'm on 2.16.7 firmware and the latest apps as per the official app loader.

    PROBLEM 1 - Slope Clock ++
    1) can never get anything to switch display in the bottom left corner.
    2) I can just about get swipes to rotate through the info display in the top right BUT the color keeps switching to red on black which is unreadable. I have set the colour selection of the SlopeClock to only black and white but still it turns red.
    UPDATE: The Red colour is the highlight color setup in slope clock++ in clockInfoDraw();

    3) I can tap the bottom left and the info disappears forever and wont come back.
    4) QUESTION: Does Slope ++ clock have a full screen option ?
    5) QUESTION: How does one control the font size of the clock info text. Is this controlled by clock info or the clock that provides the menu.
    6) I uninstalled pattern launcher in case there was some interference with the swipes
    7) Is it possible to configure clock info so that top / bottom taps can be used to cycle through the menu ?

    PROBLEM 2: Using Bw clock. I could not get Sunrise / Sunset to display. I encountered the watch hanging and had to reboot. After the reboot B/W clock would only show the top half of the clock. The bottom hallf was totally black and no amount of tapping or swiping would change the situation. Eventually I uninstalled the sunrise clock info and BW clock recovered ? Is this something to do with BW clock and sunrise having a Bangle menu.

    BW uses taps to control the cycling through the menu.

    Screenshots attached.

    The tutorial is great but a bare bones example clock based on say simplest clock would be easier to understand.


    3 Attachments

    • download.png
    • download (1).png
    • download (2).png
  • I'm trying a clock_info to simplest clock.
    I have done a new version of simplest clock that uses the new clock loading style. IE all the code between an opening and closing brace.

    I'm getting the following error on the console when I try BTN1 and BTN3.

    >
    Uncaught Error: Function "d" not found!
     at line 1 col 15
    120>e.x||(k(),d(88<e.y?1:-1))
                  ^
    in function called from system
    >
    

    Here's my code for simplest clock

    
    {
      // must be inside our own scope here so that when we are unloaded everything disappears
      // we also define functions using 'let fn = function() {..}' for the same reason. function decls are global
    
      const h = g.getHeight();
      const w = g.getWidth();
      
      let draw = function() {
        var date = new Date();
        var timeStr = require("locale").time(date,1);
        
        g.reset();
        g.setColor(g.theme.bg);
        g.fillRect(Bangle.appRect);
    
        g.setFont('Vector', w/3);
        g.setFontAlign(0, 0);
        g.setColor(g.theme.fg);
        g.drawString(timeStr, w/2, h/2);
    
        // schedule a draw for the next minute
        if (drawTimeout) clearTimeout(drawTimeout);
        drawTimeout = setTimeout(function() {
          drawTimeout = undefined;
          draw();
        }, 60000 - (Date.now() % 60000));
      };
    
      // future use
      let prevInfo = function() {
        console.log("prevInfo");
      };
    
      // future use
      let nextInfo = function() {
        console.log("nextInfo");
      };
    
      // timeout used to update every minute
      var drawTimeout;
      g.clear();
    
      // Show launcher when middle button pressed, add updown button handlers
      Bangle.setUI({
        mode : "clockupdown",
        btn : function (n) {
           if (n<0) prevInfo();
           if (n>0) nextInfo();
           draw();
         }
      });
    
      // Load widgets
      Bangle.loadWidgets();
      draw();
      setTimeout(Bangle.drawWidgets,0);
    }  // end of clock
    
    
    
  • The following code wont run in the IDE.
    I definitely have the clock_info module in flash storage.
    I have also installed sunrise_ClockInfo()
    And SlopeClock++ seems work (the top menu anyway);

    >require("clock_info").load();
    Uncaught Error: Module clock_info not found
     at line 1 col 21
    require("clock_info").load();
                        ^
    

    1 Attachment

    • Screenshot 2022-12-04 13.58.04.png
  • From the screen shot it seems you may not have followed these instructions:

    Upload the module to the Bangle's internal storage This allows you to
    develop both the app and module very quickly, but the app is uploaded
    in a slightly different way to what you'd get when you use the App
    Loader or the method below:

    • Load the module's source file in the Web IDE
    • Click the down-arrow below the upload button, then Storage
    • Click New File, type your_module_name as the name (with no .js extension), click Ok
    • Now Click the Upload icon.

    ?

    I'd have expected there to be a file named 'clock_info' but I don't see one.

  • As @Ganblejs says - You have clock_info.json there which is just the config file, not the library. It's best just to set up the IDE as he says and you don't need the file copied in then at all.

    I'm getting the following error on the console when I try BTN1 and BTN3.

    You mean you are trying this on Bangle.js 1? What firmware version are you on?

    UPDATE: The Red colour is the highlight color setup in slope clock++ in clockInfoDraw();

    Yes - the idea is this is temporary - just when giving focus to the clock_info. I'd considered just drawing a border around it, it it would interfere with the time's font.

    QUESTION: Does Slope ++ clock have a full screen option ?

    Not at the moment.

    QUESTION: How does one control the font size of the clock info text. Is this controlled by clock info or the clock that provides the menu.

    The clock. If you look at the tutorial I linked before you can see that the clock is responsible for the drawing code: http://www.espruino.com/Bangle.js+Clock+­Info

    PROBLEM 2: Using Bw clock. I could not get Sunrise / Sunset to display.

    Thats odd - maybe you could try with the IDE connected and see if it shows any errors?

  • Thank you for the support @Ganblejs and @Gordon.

    1) Having read the README I have a better understanding of how to use modules with the IDE. Apologies, my Bangle tinkering has been on pause most of this year and I am out of practice.

    2) the BW clock issue is reproducable. I have logged #2361 with with steps to reproduce. It does not seem to play well with sunrise_clockinfo.

    3) By BTN1 and BTN3 I mean the soft buttons implemented in the B2. As per "clockupdown". That is a seperate issue I will come back on. It seems the assumption is that clock_info's will be cycled by taps and swipes. I can see why that has to be the case if you want multiple menu's. I will try and implement a simple example based Simplest Clock first and come back on that.

    I think the future could be clock_info's rather than widgets :)

  • @PeerDavid - I have logged #2361 on BW clock. I get a reproducable hang when sunrise clock_info is installed.

  • Just a note that you can get the hang even without sunrise. Just start the clock and start tapping very quickly.

  • Thanks @Gordon, nearly there with my demo.

    A couple of things

    1. Does SlopeClock++ support the weather clock info ? The reason I ask is that I installed weather 0.17 and can click through the weather menus on BW clock. But I cant see the same in slopeClock++. What is the swipe tap sequence to get the weather clock_info menu to show ?

    2. I have descovered that when steps are sent in clock into that the length is not set.
      A workaround is to use info.text.toString().length

      info.text=2531
      info.text.length=undefined
      
  • Once BW clock has hung the only way I can stop the bottom half turning black and being unresponsive is to uninstall sunrise_clockinfo. I guess there could be more than one issue present here. It might be that BW clock is writing to storage after every UI interaction when perhaps it should only do so after the clock has locked. I know this was a problem before on BW clock. Or maybe the clock_info is writing state after every interaction.

  • BW clock writes settings when you exit the clock, but when it hangs there and you exit it will try to start there again... I will look into this when I have time, unfortunately I'm a bit busy right now :/

    I will also try to refactor this interaction into the module such that it can be used by BW and AI clock :)

  • Regarding the hanging tapping bug -- I guess its due to my lock heuristic where I try to prevent taps whenever the previous info was not shown yet -- otherwise it can happen that e.g. alt. is drawn above the next info...

    I will also work on this and refactoring into a module will fix both, AI and BW.

    Thanks for your reports it really helps a lot to improve it and I really like to maintain and improve my clocks :D

  • I really like to maintain and improve my clocks :D

    I noticed - thank you! It makes a big difference to the quality of them.

    There's a good reason why if you search by most-installed at https://banglejs.com/apps/?c=clock BW Clock is second only to Anton (which is installed by default!)

    Does SlopeClock++ support the weather clock info ?

    It should, yes. Have you tried left-right swipes? The clock_info is in categories and swiping left-right changes category while up/down goes within that category

  • SlopClock++ have you tied left and right swipes.

    Yes, still cant get Weather info's displayed on slopeclockpp.
    I do see a Weather menu in BW clock and can cycle through that.
    I have been seeing this message on the console at start up of slopeclockpp

    Could not load clock info "weather.clkinfo.js"
    

    This does not happen when BW clock starts up.
    I can see a blank entry for the raindrops (this is what I would expect on slopeclockpp) as well.
    NOTE: I have not setup GadgetBridge but I dont usually have to do that for a quick test on BW clock. I will try that.

    I have weather 0.17 installed from the offical loader.
    I was going to install Weather 0.22 but noticed problem.


    1 Attachment

    • download.png
  • I did a Bangle.factoryReset() and re-installed all the latest Apps.
    I still get this message when slopeclockpp starts up.

    Could not load clock info "weather.clkinfo.js"
    

    But also go a non repeatable exception using my new Lato clock.
    The exception is complaining about a hide() function that I don't have ?

    Uncaught Error: Cannot read property 'on' of undefined
     at line 1 col 2799 in lato.app.js
    a.redrawHandler=()=>e(b),b.on('redraw',a­.redrawHandler),b.use...
                              ^
    in function "f" called from line 1 col 3354 in lato.app.js
    ...f(b[a.menuA].items[a.menuB]));let e=require('Storage').readJSON...
                                     ^
    in function called from system
    Uncaught Error: clearInterval(undefined) not allowed. Use clearInterval() instead.
     at line 1 col 1207 in lato.app.js
    clearInterval(this.interval),delete this.interval,Bangle.removeListener(...
                                        ^
    in function "hide" called from line 1 col 2972 in lato.app.js
    ...dler,b.uses--,b.uses||b.hide()
    

    So far the only clock that I can see a display of the Weather clock info's is BW clock.

  • @Gordon - the new time to next sunrise.sunset is nice !
    Wonderful to see my new Lato clock just get this feature.
    Loving clock_info's


    1 Attachment

    • download (1).png
  • Regarding weather.clkinfo.js maybe @myxor, @PeerDavid or @glemco could have an idea?

    Regarding the .hide() error that sounds like something with widget_utils to me.

    It seems to me like you pretokenize apps in the app loader? Could you try installing the app again without pretokenization and without minification? I think that would give a little more legible code in the error messages.

    EDIT: After looking some more it's the clock_info module on line 214, line 250, line 89 and I think line 224 that's referenced in the error message.

  • Also, do you still get the error in Lato if you uninstall weather?

  • @Ganblejs - thanks for looking at that. I'm new to the clock_info interface. Not sure how stable it is yet. My Bangle has been unstable since going to 2v16.7 firmware. I get freezes in settings and hangs in various places. I might try the latest bleeding edge firmware.

    I can get the error in SlopeClockpp as well.

    2v16.7 (c) 2021 G.Williams
    Uncaught Error: Cannot read property 'on' of undefined
     at line 1 col 2799 in slopeclockpp.app.js
    a.redrawHandler=()=>e(b),b.on('redraw',a­.redrawHandler),b.use...
                              ^
    in function "f" called from line 1 col 3354 in slopeclockpp.app.js
    ...f(b[a.menuA].items[a.menuB]));let e=require('Storage').readJSON...
                                     ^
    in function called from system
    > 
    

    But then after a few seconds I noticed a cloud Icon as below.
    This is with weather 0.22 (previous error was with weather 0.17)


    1 Attachment

    • download (2).png
  • Getting very erratic behaviour with the weather 0.22 menus. I uninstalled waether but made the mistake of not setting BW clock back to the Bangle menu. Now its a black screen, but it seems to recover after a minute or so.

    No errors in Lato and SlopeClockpp when weather is uninstalled. But thats the issue. I would really like to see weather working in these clocks consistantly, not erratic with hangs and errors on the console etc.

  • At least now we are quite certain it's something with the the weather clock info and probably not a problem in either Lato, BW Clock or Slope Clock ++.

    And just a clarification regarding the error message saying .hide() being in lato.app.js even though it's not in the app code. If an app require()s a module, when it is installed via app loader it will add in the module code at the beginning of the app.js-file (seemingly pretokenized) so that it can be used by the app.

    I haven't been using my Bangle daily for a while now, but fw2v16.25 seems pretty stable to me.

  • I'm consistantly getting a hang when I go into settings and scoll up and down to change the color settings in slopeclockpp. I'm on fw2v16.28, only got the lock widget installed, settings, slopeclockpp and lato clocks installed. I have to reboot the watch with a long press. The problem starts when the menu scrolls off the screen - as in the screenshot. I was able to connect via the IDE but the console prompt never responded or showed up. I will try and capture more info so I can log a bug. I have stripped out unnecessary apps, widgets and rewritten the settings just in case.


    1 Attachment

    • download (3).png
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

clock_info - support

Posted by Avatar for HughB @HughB

Actions