what happens after "Serial".setConsole ? #6817
Replies: 1 comment
-
Posted at 2018-03-29 by @gfwilliams Well, it:
It's all here: https://github.com/espruino/Espruino/blob/master/src/jsinteractive.c#L168 I can't remember anything else offhand, but you'd have to look at the source of I guess it could be the Bluetooth serial write IRQ that's crashing? You need to have a way of taking data out of the Does just doing Posted at 2018-03-29 by JumJum Hmmm, I cannot find the step, where something like Bluetooth.write is called. There should be a, let me say connection/function, to write data to ESP32 bluetooth device from Serial object. Walking through jswrap_serial and jsdevices, at the end, it should go to jshUSARTKick with device = EV_BLUETOOTH, is that correct ? Posted at 2018-03-29 by @gfwilliams
Yes, and you can kick off Bluetooth transmission from there. However you still need a way to detect when a Bluetooth packet has finished sending so you can send the next one. Also, using USARTKick isn't ideal - it'll get called after the very first character. Ideally you want to be able to write multiple characters from the buffer at once. nRF52 uses a 'radio notification' event to do that: https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L744 Posted at 2018-05-09 by JumJum On my best understanding there is one major location to call USARTKick, which is jshTransmit If I would now replace many calls to USARTKick by a function that sends a string, what would be the best way ? There are pros and cons for all solutions. Looks to me, like we have to change core sources in each case. Posted at 2018-05-09 by @gfwilliams None of those methods is great. It's virtually impossible to ever get a string of data that you can send. Sure, you can do a little better sometimes, but really not that much and there are loads of cases where it's very hard to improve. Can you not do what we do on nRF5x? Figure out what we need to send in an IRQ that happens just before data is sent? If not, how about:
Or just skip the timer and send the first character on its own. That's what I did originally and it works reasonably well. Posted at 2018-05-10 by JumJum Hmm, tried to use timer. Something may be wrong in my understanding of jstExecuteFn
Posted at 2018-05-10 by @gfwilliams I think you just want:
Setting a You could then avoid I'd also forget about Realistically the polling interval for BLE connections will be something like 20ms, so having a 10ms delay really isn't going to slow anything down too much - in fact in 50% of cases it'll have no effect at all :) So I'd say something like:
Posted at 2018-05-11 by JumJum Free translation of a german proverb is, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-03-28 by JumJum
After calling Bluetooth.setConsole I get a timeout in IRQ.
Before doing this, a BLE service with
If consoleDevice = device; is commented, it works fine. Obviously on old settings.
What happens after setting consoleDevice ?
Do I have to add something to Bluetooth object ?
Beta Was this translation helpful? Give feedback.
All reactions