Avatar for Gordon


Member since Sep 2013 • Last active Jan 2023

Most recent activity

  • in General
    Avatar for Gordon


    I just tried this on a Pixl and I don't see anything from getData() - is there something I have to do to get it to record data?

    Are you connecting from https://www.espruino.com/ide/ or the Native IDE? I have seen issues with lost data using the Native IDE, but not with Web Bluetooth on https://www.espruino.com/ide

  • in Bangle.js
    Avatar for Gordon

    No actually I didn't call the E.setConsole()

    If you don't call E.setConsole(null) then Bluetooth.on('data', won't be called so your code won't work. If you do call it you can still print with Bluetooth.println

    Basically adding this function within Bluetooth.on()?

    No... I mean just code like this:

    var gatt;
    NRF.on('connect', function(addr) {
      g.drawString("Connected", g.getWidth()/2, g.getHeight()/2);
      setTimeout(()=>g.clear(), 1000);
    function X(d) { g.drawString(d, g.getWidth()/2, g.getHeight()/2); } // <----- this
    NRF.on('disconnect', function(reason) {
      g.drawString("Disconnected", g.getWidth()/2, g.getHeight()/2);
      setTimeout(()=> g.clear(), 1000);
  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Interesting, thanks! What happens if you close the web browser that you were making the request on before you make requests with the new one?

    I wonder if maybe the web browser is leaving the connection open between requests? I believe Espruino usually asks the browser to close the connection, but if it doesn't that could cause a lot of problems

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Ahh, thanks! Yes, I think maybe when you go to edit a menu item and then come back, maybe there ends up being a different copy of m.

    Anyway, I'm glad that fixed it for you! Overwriting E.showMenu is definitely the safest, most flexible way of doing it

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    As @fanoush says - you get a hardware Serial1 which should work great at higher baud rates. You don't have to use software.

    Also worth noting that you can move Serial1 between any pins, so potentially even if you need multiple Serial ports you may be able to get along with just the one bit of hardware, especially if there's RTS/CTS handshaking

  • in Bangle.js
    Avatar for Gordon

    Ahh - maybe you could try what I suggested at the start first? Just a function called 'X'?

    Bluetooth.on('data', is called when data is received, but only when you move the REPL out the way with something like E.setConsole(null) as I'd said above - and you don't seem to be doing that here?

    Try adding E.setConsole(null) to NRF.on('connect', function(addr) { but just be aware that you won't then be able to connect to flash the Bangle - you'll have to hold the button to reload the default clock (which hopefully isn't your app!).

  • in Bangle.js
    Avatar for Gordon

    Am i missing something or still a glitch in the software?

    Ok, sorry - yes, it looks like there's still some problem in the Gadgetbridge Android app :(

    So - you can go 'Activity and Sleep', then scroll right over and click on 'Live Activity' and this then works (albeit the default update interval for 'live' updates is really slow). I have fixed this for the next Gadgetbridge release though.

    However looking at the code in Gadgetbridge, it seems someone added that live HRM measurement icon in a really broken way - it has never worked for Bangle.js (or I imagine most other watches) since the icon was added.

    I was going to try and implement it, but it's broken enough that after you click the button there's no way to even turn the HRM off when you close the window... so for now I have just removed the icon.

  • in Bangle.js
    Avatar for Gordon

    Yes, being able to send error reports, or at least have the App Loader say 'we found an error, would you like to upload it' would be cool. It wouldn't be desperately hard to allow Espruino to write uncaught exceptions to a file - for instance it could just write the very last one that happened...

    However, in terms of logging...

    I have tested and it does not look like console.log('xxxx') output is sent to log.txt

    I just tried here, and messages from console.log do appear in the log. There are some caveats though:

    • If you're connected via BLE (eg to Gadgetbridge) then errors get sent there instead (you can 'view logs' in Gadgetbridge and see them)
    • If you connect via BLE and then disconnect, you have to reload before stuff appears in the log again (so long-press the button, or when you launch an app)

    I think this could be fixed reasonably easily, but even so if you're just debugging your app it's not too hard to work around.

    Chances are you won't need to log either - I bet when your app stops working it'll be because an exception was thrown

  • in Bangle.js
    Avatar for Gordon

    Did you definitely try holding BTN1 down (top right) for a few seconds? The Bangle won't turn on as soon as the button is pressed - it's to stop it coming on in transit.

    We did have an issue with Bangle.js 2 where sometimes charging wouldn't start if the battery had been totally flattened - and you could sometimes sort it by just making sure the Bangle was warm when you started charging - so you could try that.

    But if you really need to replace the battery, what you have to do is when you have the 'puck' out from inside the watch case, you carefully fold back the flex PCB with the buttons on it - then you can 'unwrap' it from around the back.

    At that point you could pull the battery out from the back, cut the wires, and solder wire-to-wire.

    Or, the better option is to remove the LCD+PCB assembly from the plastic frame, and then you can get to the PCB to unsolder the wires.

    Sometimes you can even just 'jump-start' LiPo batteries though - if you put 4v or under on the LiPo contacts, it can reset the protection circuitry and bring them back to life.

    ... but I'd try less drastic measures first!

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Does this happen after a certain number of HTTP requests to the server? Or do you think it's just a random event?

    I can try and look into this, but I'm pretty busy at the moment so I'm not sure it'll get done in the next two weeks I'm afraid. I've filed an issue at https://github.com/espruino/Espruino/iss­ues/2321 to keep track of it though

    All I can suggest for now I'm afraid is to keep doing HTTP requests every few seconds, and that might bring it back to life