• Glad you got it fixed! ideally, yes, if you could just put a note about what was wrong that'd be much better than deleting the thread, and hopefully it'll help someone else!

    I'm not sure if it's related to your issue, but what I do notice is you do g.clear(1) which resets the state of graphics back to defaults (which is great), but before you do that you use g.stringWidth which will give you the width of the string in the current font (which could be anything).

    So I'd move g.clear(1) to the start of the function...

    Also, most clocks generally use the form used in https://www.espruino.com/Bangle.js+Clock­+Font to ensure the clock face is always drawn on the minute:

    // timeout used to update every minute
    var drawTimeout;
    
    // schedule a draw for the next minute
    function queueDraw() {
      if (drawTimeout) clearTimeout(drawTimeout);
      drawTimeout = setTimeout(function() {
        drawTimeout = undefined;
        draw();
      }, 60000 - (Date.now() % 60000));
    }
    
    
About

Avatar for Gordon @Gordon started