You are reading a single comment by @fanoush and its replies. Click here to read the full conversation.
  • my bad, I wrote puck.js, I meant http://www.puck-js.com/puck.js, the script for communications you offer.

    there is a loop locking problem for sure, I have verified it using espruino 2.14 on the p8 watch, I will try to explain better.

    when using the code on this example* for communicating from a web page to an espruino device, two way comms, say sending from the device to a web page a string 40(so that the info gets split on 2 or more packets) characters long every 200ms, all is fine as long as the signal is strong. When the bt signal goes low or near lost, the espruino device reboots. You can verify it very easily, just have a led blink on every loop on the device, and force a bad signal on the phone running the web page. You will notice that the led blinks slower as signal gets worse, and eventually a reboot will follow.

    I used characteristics and all is ok for me now, just reporting it in case you want to test.

    *(https://github.com/espruino/EspruinoDocs/blob/master/tutorials/Web%20Bluetooth%20Dashboard.md#realtime-dashboard)

  • just have a led blink on every loop on the device, and force a bad signal on the phone running the web page.

    which loop do you mean is there some specific looping code you can link (your code or that puck.js)? One idea is watchdog - if you have watchdog kicking in setInterval then any busy loop or delay in native code preventing intervals from running could trigger such reboot. Another issue causing this may be be overflowing the stack or memory - generating data faster than it could be sent filling memory or call stack (by somehow nesting calls when error happens?)

  • I used the code Gordon has here(*), the write command I was sending to espruino for the loop was this one insted of the one on the example, so it was quite big, not as big as it looks ofcource, I was just returning the id and numbers,a json, but is was not a problem at all if the signal was ok, the script (http://www.puck-js.com/puck.js) was handling it nicely, only when signal was near lost the dsd6 was rebooting. 150 ms interval.

    if you use this github example on a phone with an espruino device, and add some code so that you can see a led go on and off at every interval run on the device, you will see it blinking slower as you make the make the signal worse. If not, then it is strange, maybe it is an older problem, but it sounds strange that it not known, even if solved.

    connection.write(
            "lal=setInterval(function(){Bluetooth.println(JSON.stringify({dt:Date().toString().split(' ')[4],uv:scata.state.def.auto.uvc,ps:scata.state.is.sys.pause,bs:scata.state.is.sys.busy,db:scata.state.def.is.dbg,ac:scata.state.def.auto.clean,ad:scata.state.def.auto.delay,rtod:scata.state.is.sys.run,pos:scata.state.is.pos.ball,pwr:scata.state.is.sys.pwr,lit:scata.state.is.volt.litres,pbv:ew.is.ondcVoltage(),ss:scata.state.def.sandType[scata.state.def.is.sand].speed,sp:scata.state.def.is.sand,cb:ew.is.batt(),pb:ew.is.ondcVoltage(1)}));},150);NRF.on('disconnect', function() {clearInterval(lal)});\n",
    

    (*)https://github.com/espruino/EspruinoDocs/blob/master/tutorials/Web%20Bluetooth%20Dashboard.md#realtime-dashboard

About

Avatar for fanoush @fanoush started