Failing to connect from espruino command line

Posted on
  • On one Mac (recent Macbook pro), from the espruino command line tool, with noble installed, I can see/connect to puck.js about 50% of the time. (I updated the firmware recently to improve this). For example:

    >$ espruino --list
    Espruino Command-line Tool 0.0.30
    
    PORTS:
      cd:47:aa:41:44:2d (Puck.js 442d)
      /dev/cu.Bluetooth-Incoming-Port
    

    On another Mac (Mac mini) in the same room, running the same software, I can't ever seem to connect, and I get this when scanning (see "unknown" below) with what feels like a less than 50% success rate:

    $ espruino --list
    Espruino Command-line Tool 0.0.30
    
    PORTS:
      unknown (Puck.js 442d)
      /dev/cu.Bluetooth-Incoming-Port
    

    Why is espruino on the mac mini able to "see" puck but not work out its address, or connect to it?

    I've had such limited success connecting to the thing, even with updated firmware, I'm starting to lose faith... can anyone help me understand how this might happen, and how I can fix it? I'd like to use the Mac mini (permanently on) to talk to the puck and have it control things in the real world...

  • Only suggestions to check

    1) Puck will not advertise once connected to anything else. If your Mac Pro has it, your Mac Mini can't see/connect.

    2) Mac OS versions. Are they the same? Support for BLE might not be same.

  • Thanks for the super quick suggestion. I'm not connected from one while trying to connect from the other. And both Macs are running Sierra 10.12.2. Results unaffected by restarting all the devices

  • Interesting.
    I just tried the same (espurino --list), also Mac OS X (MacBook Air) and have drops too.

    But when lowering the advertising interval like

    NRF.setAdvertising({},{interval: 50})
    

    it seems to be found in all cases.
    Tried 300, 200, 100 too and still drops there.

    Suppose this interval will not improve battery life, but may be a hint why it does not always work?

  • @mozz100 how are you finding connecting using the Web IDE? Does that work fine?

    I think I have an issue open to try and improve the reliability of the command-line tool - it could definitely wait a little longer while scanning for devices to connect to.

  • I am using the Mac Mini over ssh - don't really want to put Chrome on there to test the Web IDE, but I might resort to that. (From the laptop, the web IDE connects quite well and fairly quickly.)

    It's not about reliability, to be frank: on the mac mini, espruino command line very consistently fails to connect :-(, and when it does "see" the puck, it always reports "unknown" as the address. If it wasn't for the laptop I wouldn't even know what its MAC address was.

    So this is the failure I always see on the mac mini. It works about 1 in 2 from macbook.

    espruino -p cd:47:aa:41:44:2d
    Espruino Command-line Tool 0.0.30
    
    Connecting to 'cd:47:aa:41:44:2d'
    Port "cd:47:aa:41:44:2d" not found
    Unable to connect!
    
  • Can you try updating espruino from NPM and doing it again? I tweaked it so it now waits longer to find BLE devices (if it needs to).

    noble, the library used for BLE, says:

    Note: on OS X the address will be set to 'unknown' if the device has not been connected previously.

    Which is a bit frustrating - I guess as you've never used the Web IDE on it, it wouldn't get reported. Try espruino -p unknown and see if that helps? It may work.

  • OK well maybe I have to install Chrome and go through that. Before I do, I updated espruino (0.0.31) and noble (1.7.0). Console output:

    houghton:~ mozz$ espruino --list
    Espruino Command-line Tool 0.0.31
    
    PORTS:
      TEST (test)
      /dev/cu.Bluetooth-Incoming-Port
    houghton:~ mozz$ espruino -p unknown
    Espruino Command-line Tool 0.0.31
    
    Connecting to 'unknown'
    Port "unknown" not found
    Unable to connect!
    houghton:~ mozz$ espruino -p TEST
    Espruino Command-line Tool 0.0.31
    
    Connecting to 'TEST'
    No result found - just got "\u0003\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    Connected
    
    
    

    So I think I'm talking to the correct device ("TEST"?) but I get this "No result found..." and I can't issue commands. I tried, but the REPL doesn't seem to be working. Could be because I'm using ssh, terminal settings or something. I have to hit Ctrl+C twice pretty quickly to get out.

    Thanks for the support.

  • I'm afraid TEST is as it looks - it's just a test device which connects to no external hardware. It shouldn't really be included in the tool.

    If espruino --list doesn't find anything then it might be because your Puck is still connected to the other computer? You need it to list the actual device - even if it's saying unknown as the address - then you stand a chance of connecting.

  • The puck isn't connected to the other computer, because that computer is next to me, switched off, and I'm about 5 miles away from the puck! The puck is a few feet away from the mac mini (houghton) into which I am sshing. I might be ready to accept defeat on this...

  • Hmm - not sure how I can help... The espruino --list you ran right at the start reported the Puck.js, and now it doesn't.

    I think if it was doing what it was doing originally then you'd actually be able to connect to it just fine now.

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

Failing to connect from espruino command line

Posted by Avatar for mozz100 @mozz100

Actions