• Hi Gordon,

    Thanks for the reply. Some answers to your questions:

    Is it a completely different number, or just the difference between public/random?

    This is what I get when I print(device) right after NRF.requestDevice():

    BluetoothDevice: {
      "id": "d1:1a:a8:29:8c:0d random",
      "rssi": -62,
      "data": new Uint8Array([2, 1, 6, 9, 9, 78, 88, 84, 71, 78, 32, 35, 50]).buffer,
      "name": "devicename"
     }
    

    I get the same for active:true and active:false (except for RSSI, of course)

    The usual fix for this would be a long timeout, but it seems you're already doing that. My guess would be that the device is advertising its name in a scan response packet (only available with active:true rather than in the main packet).

    According to the sensor documentation the local device name is included in the regular advertising packet, but the manufacturer-specific data is included in the scan response (active scan).

    The device is designed to live for many months on battery, so I suspect it sleeps a lot and minimizes transmissions. nRF Connect says the advertising time is 7ms, but I can see 5 to 10s between packets from the device. So I am not surprised that Espruino misses the device occasionally ... it's not a problem, I can just re-scan.

    I guess what might be happening is: the BLE device you connect to advertises very rarely (1 sec or less) and only speeds up when it gets asked to provide a scan response in an active scan.

    Sounds plausible.

    That's really strange. The 2v04 firmware is really very reliable with Bluetooth and I can't remember the last time I crashed it while connecting to anything. You mentioned a Serial connection earlier - if this happens again please can you try while connected on Serial and see if any errors get reported.

    Could the cause of the closed connection also be on the Mac OS side (e.g. the Mac Espruino IDE or the Mac OS Bluetooth support)? I will try and capture a reproducible situation for this disconnect and let you know.

    Am I right in thinking you're in Germany? If this continues to be an issue is it possible that you could lend me one of those devices to try out?

    Yes. I only have one loaner device from the company, but it may be possible to get another one for testing.

    I have now fixed it, so if you try with a 'cutting edge' firmware from http://www.espruino.com/binaries/travis/­master/ you may have more success.

    Great, thanks. I will try that out tomorrow, I hope.

    It still doesn't explain the crashes you were seeing though as mine just failed with ERROR Connection Timeout each time.

    I tried many different permutations over the last few days so I am not sure about the exact circumstances under which this happened. Will try and reproduce.

    Thanks again,
    -- Terrence

About

Avatar for user103949 @user103949 started