Avatar for jeffmer


Member since Apr 2020 • Last active Nov 2021
  • 7 conversations

Most recent activity

  • in Porting to new Devices
    Avatar for jeffmer

    Are you using the command function built into my version of lcd_spi_unbuf
    as in var cmd = lcd_spi_unbuf.command? If you are using SPI write directly as it looks like you might be you would get this error. Another thing to try is to not set double buffering on in the board file.

  • in Projects
    Avatar for jeffmer

    The advantage of using the Bangle is that the firmware in jswrap_bangle.c and nmea.c turns the NMEA strings received from the GPS device into espruino events. To implement the server on the B5 you would need to have an NMEA parser etc - probably too slow in Javascript so it would probably need firmware hacking - although all the software is already there for the Bangle 2. A further advantage is that the Bangle has a relatively large 350maH battery. Advantage would be that the B5 is smaller to carry around:)

  • in Projects
    Avatar for jeffmer

    Bangle GPS service for Kospet ROCK and Magic 3

    In a previous post I posted the image of a Bangle simulation environment for the ROCK and Magic3 watches. These watches have an NRF52840 processor and a large 240x280 screen which in the case of the ROCK is very bright.

    The image showed Wave Clock loaded directly from the BangleApp Loader as a demonstration of the Bangle emulation environment for the ROCK. However, this is very limited as many of the most interesting Bangle Apps use sensors such as GPS so following an idea suggested some time ago by @fanoush, I have implemented an App for the Bangle which provides a BLE service that makes the Bangle's GPS readings available externally.


    Using this, the ROCK and Magic 3 can now run Bangle GPS apps loaded again directly from the App Loader. The Open Street Map App is shown below:


    The interface to the GPS on the Bangle 1 & 2 is very narrow and that facilitates emulation. For interest, I include the full emulation code here:

    Bangle.setGPSPower = function(on){
        if (Bangle.gpsOn && on) return; //already started
        function unpack(v){
            var fix = v.getInt8(29);
            function ck(d) {return d==-1 ? NaN : d;}
            return {
              time:new Date(v.getFloat64(20)),
        if (on) {
            NRF.requestDevice({timeout:4000, filters: [{ name: 'gps' }] }).then(function(device) {
            return device.gatt.connect();
            }).then(function(g) {
                Bangle.gpsgatt = g;
                return g.getPrimaryService("974e0001-1b9a-4468-­a83d-7f811b3dbaff");
            }).then(function(service) {
                return service.getCharacteristic("974e0002-1b9a­-4468-a83d-7f811b3dbaff");
            }).then(function (c) {
                //console.log("Got Characteristic");
                Bangle.gpsInterval = setInterval(function(){
                E.showMessage("GPS: "+e,"ERROR");
        } else {
            if (Bangle.gpsInterval) Bangle.gpsInterval = clearInterval(Bangle.gpsInterval);
            if(Bangle.gpsgatt) Bangle.gpsgatt.disconnect();
            delete Bangle.gpsgatt;
            delete Bangle.gpscharistic;
    Bangle.getGPSFix = function() {return Bangle.gpsFix;}

    The Bangle GPS server code can be found here.

    I have found the Bangle 1 GPS to be more sensitive than the Bangle 2, so it may be that if you have both Bangles, this may be of use. I have found the Bluetooth link between ROCK and Bangle really reliable and its no problem to carry the Bangle in a top pocket or a back pack.

  • in Porting to new Devices
    Avatar for jeffmer

    I have now finished an initial version of a Bangle compatible environment for the ROCK and Magic3 watches. You can find it in this repository. The firmware uses a double buffered version of lcd-spi-ubuf.c which combined with 32Mhz SPI gives much faster screen update than was possible on the P8. The Bangle emulation is implemented in Javascript so is easy to update. Emulation functions are loaded into the NRF52840 internal flash for better performance. They allow you to load apps directly from the Bangle App Loader if you ignore the warnings, however, since the ROCK and Magic3 have very few sensors it is really only Clock apps that are truly portable. As an example, the Wave Clock which runs on both Bangle and Bangle 2 is shown below running on the ROCK - it was loaded straight from the official Bangle App Loader:


    The emulation has versions of setUI options so menus and prompts work.

  • in Bangle.js
    Avatar for jeffmer

    In my case, I am not getting this error anymore. It could either have been restarting my Linux host or rebooting the watch - I suspect both:-)

  • in Bangle.js
    Avatar for jeffmer

    I have also been getting a lot of these FIFO_FULL errors from a build of the latest version of Espruino for an NRF52840 - although it is for a Magic 3 watch. It seems to happen for me after interrupt generated events although I have also got it when loading a large amount of code from the editor window of the IDE into RAM.

  • in Porting to new Devices
    Avatar for jeffmer

    Yes, but I am afraid that I did not follow the Bangle conventions exactly so my apps did require tweaks. I agree with your views on jswrap_bangle.c but I think the new touch and layout stuff is worth getting to work on the P8.

    BTW does the Kospet Rock have a touch screen? It looks like it has three buttons.

  • in Porting to new Devices
    Avatar for jeffmer

    Actually, for the P8, I did not use jswrap_ bangle.c as I found it easier to develop drivers in Espruino. I intended to put these into C afterwards but the Espruino driver performance seemed quite useable so I did not bother. I plan to look at using the new Layout and touch UI stuff in the coming weeks as it should then be possible to run standard Bangle apps on the P8.

  • in Other Boards
    Avatar for jeffmer

    Hi, no plans to merge at the moment as I also had to add non-standard Espruino fns to disable and enable SPI to switch between lcd driver and storage access. Gordon rightly thinks this is a bit of a hack. It is unique to the P8 as in shares SPI. I will update the build to current Espruino in the next few weeks when I get a chance.