You are reading a single comment by @SergeP and its replies. Click here to read the full conversation.
  • Ahh, ok - for the first problem, if you send "{c:{w:20,a:1},id:2}" then I guess you'll be fine. The parsing is because Espruino is expecting you might want to use [1,2,3,4] to send binary data. I've just made a tweak that should make your old code work fine though.

    EspruinoHub often stops to connect to device without any resonable log

    If you go to http://yourdevice:1888/status do you still see the device you're trying to connect to shown? Maybe for whatever reason it isn't seeing it in the advertising data?

    Third problem is packet reassembling at device

    That's an idea. So the only actual change would be if packet size =20 it'd send a blank packet? If you're just sending JSON I'd suggest just adding a newline to the end though - then you could send through normal Nordic UART endpoint and handle it really easily?

  • I've just made a tweak that should make your old code work fine though.

    Great! I've changed EspruinoHub to my code can work, but it is good to use regular one. Because the problem may be not only my problem.

    If you go to http://yourdevice:1888/status do you still see the device you're trying to connect to shown? Maybe for whatever reason it isn't seeing it in the advertising data?

    It seems to me, device is in place and advertizes carefully :) But string 'Scanning stopped' and subsequent strings will not appears anymore before EspruinoHub restart. I'll try to mine additional info.

    So the only actual change would be if packet size =20 it'd send a blank packet?

    Exactly! If last packet chunk size =20, send a blank packet after. It is like USB works (I'm not sure that USB3.2 uses the same, but up to 3.0 it uses the method to reassemble data). I've implemented that in EspruinoHub (but my code is ugly while correct) and I'm happy. I think it may be useful not only for me.

About

Avatar for SergeP @SergeP started