-
Ok, wow - that's news to me. I think there's a very high likelihood it's to do with the micro:bit's USB-TTL conversion. Does it happen on other boards.
I don't know.
No... I haven't come across it. I guess it could be losing the serial data somewhere along the line?
Is there a tool I could use to monitor raw serial data?
-
serial break? I'm not quite sure I understand...
In JavaScript, I call
port.setSignals({ brk: true });
which sends the break signal.You could send "\x03\x10reset()\n"? The issue (I believe) is that on 'normal' USB Espruino boards the USB goes right to the microcontroller running Espruino, so it can keep the serial data buffered until it sees a connection.
I've tried this without luck sadly.
I could be wrong but I think that everything still works ok, just not the magnetometer?
Indeed
compass()
andacceleration()
don't work.One more and last thing
I've noticed2v06 (c) 2019 G.Williams
in the prompt message was sometimes missing the ending\n
. Basically ending with\r
, instead of\r\n
. Is this a known issue? -
I'm currently using the Serial Web API to communicate with the BBC micro:bit and I'm loving it so far!
There are some nits I'd love to understand though and I thought you folks may know the answer.I'm able to connect to the BBC micro:bit device and open the serial port at 9600bps. /me happy
Then my readLoop doesn't show anything until I turn off serial break for instance. Is this expected?
Is there another way to "force" the device to send the usual prompt when port is opened?Then, the prompt I get contains the "Uncaught InternalError: I2C Write Error 33281" message as shown below. Is there something going on I should fix?
script.js:53 [J[?7l script.js:53 ____ _ script.js:53 | __|___ ___ ___ _ _|_|___ ___ script.js:53 | __|_ -| . | _| | | | | . | script.js:53 |____|___| _|_| |___|_|_|_|___| script.js:53 |_| espruino.com script.js:53 2v06 (c) 2019 G.Williams script.js:53 Espruino is Open Source. Our work is supported script.js:53 only by sales of official boards and donations: script.js:53 http://espruino.com/Donate script.js:53 Uncaught InternalError: I2C Write Error 33281
-
-
-
@Gordon is right.
Web Bluetooth is supported by default (no flag) on Mac, Android and Chrome OS.
On Linux, you needchrome://flags/#enable-experimental-web-platform-features
experimental flag for now. -
@Ollie I would follow https://github.com/WebBluetoothCG/web-bluetooth/issues/342 for now ;)
-
Here's what we know from Emil:
Unfortunately, no platforms I'm aware of have well-defined behaviour
nor documented APIs to handle the case when the maximum number of
connections is reached. It seems people working on Bluetooth stacks
have not really thought, cared about or even tested what will or
should happen if users have many BLE devices. As an example, the
Bluetooth stack in Android hangs if you have 7 BLE connections and try
to establish the 8th with "autoConnect=true" (in the way that it will
never again connect to BLE devices until Bluetooth is restarted, even
if the 7 get disconnected). If you have GATT notifications you listen
to in Windows and are above the maximum number of connections, you get
no event telling this, so some notifications will not be delivered to
your computer (since the peripheral can't connect). Generally among
most platforms some random error code is thrown (general failure,
internal error, unspecified error, gatt error) when you actively try
to connect a new device when the maximum number of connections has
been reached. Sometimes a better error code like "no resources" is
thrown. The non-existing documentation of error codes that is
unfortunately general among all BLE implementations is very annoying
when you are an app developer (Windows must be the worst when they're
trying to map BLE errors to their general 0x80... HRESULT error
codes).Source: https://github.com/WebBluetoothCG/web-bluetooth/issues/342#issuecomment-268117085
-
Here are my notes when building BlueZ that might be helpful: https://github.com/beaufortfrancois/sandbox/blob/gh-pages/web-bluetooth/Bluez.md
-
Hey @Ollie, I'm glad this page helped.
Do you mind sharing what you were doing so that others can benefit.
We could update https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web and add a warning if it is a common issue.Thanks in advance ;)
-
@Gordon There's not one single web page strictly speaking that allows you test the Web Bluetooth API. For now, the best you can have is available at https://googlechrome.github.io/samples/web-bluetooth/
-
-
-
@MyBlueBoo I'll be trying to improve multiple adapters situation. See comment at https://bugs.chromium.org/p/chromium/issues/detail?id=635111#c22 and following feature request at https://bugs.chromium.org/p/chromium/issues/detail?id=679287
-
Re: handling multiple BT adapters,
We've started to think about how to proceed at https://bugs.chromium.org/p/chromium/issues/detail?id=635111
In the mean time, as suggested by @Gordon, I would simply make
hci1
default for now with theselect
command frombluetoothctl
and restart Chrome. Hopefully this will help:$ bluetoothctl [NEW] Controller 12:34:56:12:34:56 Foo [default] [NEW] Controller 12:34:56:12:34:57 Bar [bluetooth]# list Controller 12:34:56:12:34:56 Foo [default] Controller 12:34:56:12:34:57 Bar [bluetooth]# select 12:34:56:12:34:57 [bluetooth]# list Controller 12:34:56:12:34:56 Foo Controller 12:34:56:12:34:57 Bar [default]
-
As you can read at https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md#notes, Web Bluetooth on Android requires Android 6, Marshmallow or later.
However, tip of tree Chromium builds work on Android 5, Lollipop and later for ease of developers - but Chrome versions will only ever support Marshmallow or later. See http://stackoverflow.com/q/34810194/422957
-
Thanks!
Can you also reproduce with https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html?namePrefix=Puck.js? -
Do you mind sharing logs (both chrome and MacOS)?
See https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs -
NRF.setAdvertising({}, {name: "\xF0\x9F\x8D\x9F"});
works great! Thanks
I can see French Fries now ;) -
Why not use TextEncoder Web API there?
-
-
From what I understand. If the Puck is connected to something, it stops advertising, and so doesn't show up to anything else that you scan with, whether it's a phone, different computer etc. I may well be wrong, but that's how it looks.
Yup!
I think that the issue may have arisen when I tried to make my Puck into a Play/Pause button (HID).
You're right. I was able to reproduce this issue when changing my Puck.js device to a HID button. This means that when https://codereview.chromium.org/2513323002/ is applied to Chrome, you won't have to
remove
Puck.js device anymore.I'm glad we got this sorted eventually. I'll update this thread when it happens.
-
@gomako @skinofstars I'd love to get more information on this issue as it could be helpful to make the Web Bluetooth API more reliable.
- Is puck.js still connected in macOS Bluetooth Menu when Chrome is killed?
- What do you mean by auto-connect?
- It could be possible that puck.js doesn't show up in Web Bluetooth chooser within 10s. Did you try click "re-scan" link?
- Can you reproduce this issue with Chrome Canary?
For info, I've been trying to reproduce this issue on macOS and the only way I've found was to connect puck.js with another native macOS application. In that case, Web Bluetooth chooser doesn't show yet the connected device. Patch is in process to solve this issue but I'm not sure that's the issue you're both had.
- Is puck.js still connected in macOS Bluetooth Menu when Chrome is killed?
NDEFWriter has been merged into NDEFReader recently. See https://github.com/espruino/EspruinoDocs/pull/589