Avatar for jeffmer


Member since Apr 2020 • Last active May 2020
  • 3 conversations

Most recent activity

  • in Bangle.js
    Avatar for jeffmer

    Thanks, that’s a great idea, I will try it as a widget, although, I will have to work out some way of restoring the button handlers after the screen is grabbed for an alert.

    ** That works well. Will submit pull request for widviz widget.

  • in Bangle.js
    Avatar for jeffmer

    I have quite a few widgets running such as battery, bluetooth, gpsrec, ANCS etc and although they are incredibly useful, they do clutter up the screen and take away from the design simplicity of some of the clock faces I use. In an attempt to have the best of both worlds, I have added the following code to the clock apps I use. Touching the left side of the screen hides all widgets and touching the right side re-displays them.

    var widgetVis = {
          if (!Bangle.isLCDOn() || this.saved) return;
          this.saved = [];
          for (var wd of WIDGETS) {
          if (!Bangle.isLCDOn() || !this.saved) return;
          for (var wd of WIDGETS) wd.draw = this.saved.shift();
          setWatch(this.hide, BTN4, {repeat:true,edge:"rising"});
          setWatch(this.reveal, BTN5, {repeat:true,edge:"rising"});

    It is not enough to simply blank out the widget area and then avoid calling drawWidget() since many widgets redraw based on timer events etc. The methods above replace widget draw functions with null functions and then restore the old draw functions when widgets are not hidden.

    If others feel this is a useful facility, it might be sensible to have a standard way to hiding widgets while leaving them running. There may well be a better way of doing this than the one I have outlined.

  • in Bangle.js
    Avatar for jeffmer

    If you are connnecting from the Bangle to the MDBT42q, the event will be received by:


    NRF.on(‘disconnect’,...) will work on the module - with no Bangle.buzz() of course.

  • in Projects
    Avatar for jeffmer

    Yes, Gordon’s createArrayBuffer and drawImage with palettes are exactly the same mechanism. Actually you can usually get away with one or two buffers and move them around to write at different times. My gpsnav app uses only one buffer which is used every 200ms to draw the compass display and once a second for numerical data display.

    Combining javascript and compiled C in your driver is really neat, I was going to ask to see it!

  • in Projects
    Avatar for jeffmer

    The rotating cube looks quite fast - fast enough to use as you note. With hardware supported SPI, I have previously managed to get quite good performance for a relatively simple Arduino based ILI9341 driver - see.

  • in Projects
    Avatar for jeffmer

    Very impressive indeed. How does the speed of the SPI display compare with the 8-bit parallel Bangle version?

  • in Bangle.js
    Avatar for jeffmer

    Apologies for the length of this post, however, I would really like to find out if the widget works for other people and I would appreciate feedback on some of the issues mentioned in the following.

    iPhone ANCS widget available for testing

    This widget allows you to answer or cancel iPhone incoming calls and also displays messages. It connects to the Apple Notification Center Service which is already on all iPhones, so you do not need to install any additional iPhone apps to use this widget.

    Warning - this is very much a beta release and although so far it appears quite stable, you may get the odd crash when moving between apps which will require a reboot - pressing BTN1 & BTN2 for 6 seconds. See issues at the end of this file.


    First,you must update to the latest Bangle firmware - v2.05v27 or later.

    This beta version can be installed from this repository's app loader - https://jeffmer.github.io/JeffsBangleApp­sDev/. The widget will only run with a compatible clock app - see below. There are three listed in the App loader so install one or all three as they are linked and pressing BTN1 or BTN3 if they are not all installed will cause a black screen of death. Once installed, the widget will only appear in a compatible app when enabled in the Bangle Settings app - ANCS Widget will appear in APP/Widget settings.

    iPhone Pairing

    Once enabled, the widget icon should be displayed coloured grey (its green in the photo). Go to the phone's Bluetooth settings menu and your Bangle should appear under Other devices. If this is the first time you have connected with the Bangle from your iPhone, it may be named Accessory. Click on the name and the iPhone should connect and start pairing. The widget icon will turn red and the iPhone will ask you to enter a pairing code - the traditional 123456. After that, the iPhone may also ask to allow the device access to ANCS. Once pairing is complete, the widget icon should go blue and eventually green. The range of colours is:

    • Grey - not connected - advertising
    • Red - connected - not paired.
    • Blue - paired and connected - getting services
    • Yellow - got Services - discarding old notifications.
    • Green - waiting for new notifications - calls and messages only in this implementation.

    After pairing the first time, the Bangle should connect automatically when the widget is running. Sometimes you may need to click on the Bangle name in Settings:Bluetooth:My devices on the iPhone or disable and then enable Bluetooth to start connection. You may also need to get the iPhone to forget the bond if you want to connect the App Loader or Web IDE.

    Messages & Calls

    Messages are displayed as shown above until BTN2 is pressed to dismiss it. I strongly advise disabling the BTN2 LCD wake function in the Settings App as otherwise when the screen times out and you press BTN2 to wake the LCD, the screen will turn on and the Message Alert will be dismissed!. Calls can be answered or dropped.



    1. With GadgetBridge, the Android phone has a Central-Client role with the Bangle as Peripheral-Server. With the ANCS widget there is the fairly unusual situation in which the Bangle is Peripheral-Client to the iPhone's Central-Server role. Firstly, since Espruino does not deal explicitly with Bangle as Peripheral-Client, we have adopted the bodge outlined in an earlier posting and immediately connect back to the iPhone after the iPhone initiates the connection due to its Central role. This usually works, however, sometimes and especially when phone and Bangle are quite far apart, the Bangle connects in Peripheral-Server mode and the widget cannot get the Peripheral-Client connection it needs. The symptom is that the Bluetooth widget goes blue indicating connection from Central and the ANCS widget icon is grey indicating it has no connection. This should be fixed when Gordon deals with Issue 1800. Currently - the solution is to bring the Bangle near the phone and switch apps to force a reconnection attempt.

    2. When the Bangle switches apps, all state - including widget state - is lost unless explicitly stored. The consequence of this is that when the Bangle switches apps, the connection to iPhone has to be re-established to restore the remote GATT server and characteristics state. This is quite slow. To minimise reconnection, the widget needs to grab the screen from the running app to signal messages and calls. To allow this to work, the app needs to implement the SCREENACCESS interface. In essence, the widget only connects when running with compatible apps that implement this interface. An example of an implemented interface is:

    var SCREENACCESS = {
            stopdraw(); //clears redraw timers etc
            clearWatch(); //clears button handlers
            startdraw(); //redraw app screen, restart timers etc
            setButtons(); //install button event handlers
    Bangle.on('lcdPower',function(on) {
      if (!SCREENACCESS.withApp) return;
      if (on) {
      } else {

    I would be very interested in a less instrusive way of doing this, however, the solutions for full screen alerts that I have seen involve switching apps.

  • in Bangle.js
    Avatar for jeffmer

    Amazing - all works perfectly. Expect ANCS app & widget soon - touch wood!