• Hi guys. I'm surprised by the ease of use of the Puck.JS in general, nice work!

    I want to change the name of the (Bluetooth) device without overriding the Espruino services. In other words, I want to change the name from "Puck xxxx" to "Hello" but still be able to connect using espruino.com/ide.

    I tried this, but after disconnecting I cannot connect again. I see that the device is advertising using the name "Hello", However, in order to upload new code, I have to reset the Puck.JS. I guess there must be an easier way?

    NRF.setAdvertising({}, {
      name: "Hello",
      showName: true,
      discoverable: true,
      interval: 600
    });
    

    Thanks!

  • Try refreshing the online IDE website now and trying again.

    This was actually because of a (now fixed) bug in Web Bluetooth on Mac, which meant that it didn't always 'see' devices based just on their advertised services - it had to use their names instead.

    As a result it was changed to show anything with a name starting with Puck.js or Espruino.

    Earlier today we changed the code to work based on service as well as name, and I have just updated the online IDE with it. However if you're on Mac you may still need to use Chrome Canary (version 57) to reliably see devices that have different names.

    So in short, Puck.js is working fine - it's the IDE that couldn't connect.

    Also, setting an advertising interval of 600 might make it slightly harder to connect.

    If you just want to change the name, all you need is:

    NRF.setAdvertising({}, {name: "Hello"});
    
  • Cool, now it works! Thanks for the quick feedback.

  • By the way, there's an issue with saving and loading source code via the web IDE:

    Uncaught TypeError: Cannot read property 'chooseEntry' of undefined
        at loadFile (file.js:79)
        at HTMLAnchorElement.click (file.js:36)
        at HTMLAnchorElement.dispatch (jquery-1.11.0.js:4624)
        at HTMLAnchorElement.elemData.handle (jquery-1.11.0.js:4292)
    
  • Thanks - yes, I'd forgotten about that. It's because it's originally a Chrome Web App and I believe there were some 'special' APIs it could use.

    I've filed an issue for it - but if someone gets a chance to have a look at it before me it'd be hugely appreciated - I've kind of got my hands full at the moment :)

  • Actually forget that - I'll fix it now. Looks pretty easy

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Change device name without overriding Espruino services

Posted by Avatar for nielsmouthaan @nielsmouthaan

Actions