EspruinoHub Issues

Posted on
  • Hi all,

    I've now setup a rpi3 with EspruinoHub. Instead of using the minimal raspbian image as before, I chose the full image and pretty much followed all instructions. Instead of installing node the way it is described in the tutorial, I went with the node version mananger, which worked very nicely. Now the issues:

    • if there is no puck in reach or no ble devices, the hub will stop after a few seconds. What is the reason for this? I can well imagine that sometimes no devices are in reach, I would want the hub to stay active all the time and wait for a device to appear.
    • I've used the sample code given in the tutorial, but I get some issues:

      NRF.requestDevice({ filters: [{ services: ['1823'] }] }).then(function(device) {
      require("ble_http").httpRequest(device, "pur3.co.uk/hello.txt", function(d) {
      print("GET:",JSON.stringify(d));
      });
      });
      

    Once I connect to my (whitelisted) puck and upload the code with the Espruino IDE, I get this:

    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v91 Copyright 2016 G.Williams
    >
    =undefined
    Connected
    Uncaught Error: Unhandled promise rejection: Disconnected.
    >
    

    In the EspruinoHub console, I see that a device connected, but after this short intermezzo and no other significant error message (almost nothing, I see that my puck got scanned and it's RSSI), the hub then also terminates. Any idea?

  • Adding to that, it also seems the puck then needs to be reset to advertise again. If I just restart the hub and push the code a second time (the ide does not seem to mind, looks connected in the IDE), the hub cannot find the puck.

  • It's true that the hub will terminate if it doesn't detect any advertisements for around 10 seconds. The way the code is written if no advertisements are detected the hub assumes something might be wrong so it exits. If you're using the start.sh script in the foreground the hub will then restart. But again, if no advertisements, well you get the picture.

    For your other error it looks like the .httpRequest is failing and since there is no rejection handler and no catch you get the Uncaught Error report. If the hub is also exiting there may be a problem there causing the httpRequest to fail in turn.

    Lastly, in my experience it's not unusual to have to reset the puck if a ble request fails badly--like if the hub crashed during the request. Sometimes it will become visible again on its own. Like if a timeout expires. But often not.

  • if there is no puck in reach or no ble devices, the hub will stop after a few seconds

    We could add a setting to turn that off - but realistically I was expecting that some BLE devices would always be in range for most people. It was just a good way of ensuring that some part of the BLE stack hadn't died. It might be less of an issue now as @dklinkman found that advertising scanning just gets stopped.

    the ide does not seem to mind, looks connected in the IDE

    When the IDE is connected, the Puck won't advertise. It could be that's what you're hitting?

    When you reset the Puck, the connection drops and it advertises again.

    EspruinoHub keeps showing a BLE device for 60 sec after the last advertising packet, so you may be thinking the Puck is still advertising when it isn't.

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

EspruinoHub Issues

Posted by Avatar for hansamann @hansamann

Actions