Avatar for skm

skm

Member since Apr 2020 • Last active Jul 2020
  • 2 conversations
  • 7 comments

Most recent activity

    • 12 comments
    • 581 views
  • in Bangle.js
    Avatar for skm

    Nice work. Yes, hangs for me very quickly, no response to Ctrl-C in IDE console.

  • in Bangle.js
    Avatar for skm

    Took out the second g.reset() and it still hung, at 19220 this time. I have previously had the app hang without RAM Widget loaded so the fact that it hangs with the Bluetooth widget displayed would seem to implicate Battery Level Widget (with percentage). Running another test just now, will see if I can get anywhere with Ctrl-C.

    edit: I see suspicion about Battery Level Widget is growing :D

  • in Bangle.js
    Avatar for skm

    I have been wrestling with my app mysteriously hanging, requiring a long press of BTNs 1 and 2, and believe I have tracked the problem down to Bangle.drawWidgets. It happens randomly and I have only ever seen it happen when both GPS and HRM power are enabled. The widgets I currently have loaded are Bluetooth Widget, Battery Level Widget (with percentage) and RAM Widget. The following code demonstrates the problem:

    var ctr = 0;
    g.clear();
    Bangle.loadWidgets();
    Bangle.drawWidgets();
    Bangle.setGPSPower(1);
    Bangle.setHRMPower(1);
    setInterval(function(){
      g.reset();
      g.setFont("6x8", 3);
      g.drawString(ctr.toString(),60,60,true);­
      if(ctr++%10 == 0){
        g.reset();
        Bangle.drawWidgets();
      }
      g.flip();
    },100);
    

    When it hangs, which can take anywhere up to an hour, the count is always a multiple of 10 (e.g. 16140 in my final test just now) - hence my assertion that drawWidgets is triggering the problem - and the only widget remaining visible is the bluetooth symbol. The app hangs on both the current stable firmware and bleeding edge. Nothing is logged on the console and memory usage (when running test code above) was stable at 22%.

  • in Bangle.js
    Avatar for skm

    That appears to work fine, thanks. I also need to g.reset() at the start of any text-displaying functions which are triggered by button presses.

    • 6 comments
    • 389 views
  • in Bangle.js
    Avatar for skm

    Thanks, and sure enough, I found a thread from a couple of months ago where the same problem was described and the g.reset() solution was advised, but isn't this actually a race condition? If a widget can call bangle.drawWidgets() itself, wouldn't I really need to call g.reset() before every single instance of g.drawString() etc., and even then, it would only maximise my chances of winning the "race"?

  • in Bangle.js
    Avatar for skm

    After a good deal of testing I have come to the conclusion that either I am handling widgets incorrectly in the app I am working on, or at least one widget (RAM Widget in this particular case) is misbehaving. The problem can be demonstrated with this simple code snippet:

    g.clear();
    Bangle.loadWidgets();
    Bangle.drawWidgets();
    g.drawString("hello world",64,64);

    The string "hello world" appears on the display somewhat to the left of the expected 64,64. If I comment out the Widgets lines, it appears at 64,64 just fine. Battery Level Widget (with percentage) and Bluetooth Widget don't cause this problem. So is it my code, or is it RAM Widget, or possibly even the firmware?

  • in Bangle.js
    Avatar for skm

    I got a bunch of 20mm piezo discs off Amazon, removed the casing from one with a pair of pliers, and soldered it into the watch as per the video - works fine.

Actions