NRF.setServices .. onWrite called twice #5699
Replies: 1 comment
-
Posted at 2023-01-30 by @gfwilliams I'm not sure what to suggest here I'm afraid... The way You could also check on your watch to ensure your code isn't in there twice (eg in two separate files). You could check with:
If it's ok, it should be in just Posted at 2023-01-30 by !evil I found the issue, and its not Espruino/Bangle. The callback isn't called twice (should have count it earlier) but the returned message on Nordic UART is processed twice on the remote side (Arch Linux, Intel 7260, Bluez 5.66). But only if I didn't remove the device using Sorry for the distraction! For future reference: when the custom characteristic is added, and my Bluez already knows about the Nordic UART from previous discover, it would immediately disconnect after connect. So I'm forced to remove and rediscover. If, however, it knows about the custom characteristic and the custom characteristic is added during a reset, it wouldn't disconnect after connect but process incoming messages twice. Or at least thats what I see and I'm able to reproduce. Remove and rediscover solves the issue for me. Posted at 2023-02-01 by @gfwilliams
That's a good one to know... I had occasionally got into an odd state that required removal of the device (and IIRC that is somewhere in the bluetooth troubleshooting docs) but I didn't know why! Out of interest, how do you remove? Just with the OS's Bluetooth Menu, or via some command-line? I find the OS menu very difficult as it's got about 1000 devices in it for me! Posted at 2023-02-01 by !evil With |
Beta Was this translation helpful? Give feedback.
-
Posted at 2023-01-27 by !evil
Hi,
there is
NRF.setServices
and I have no trouble setting up a custom service and characteristics when executing code in the IDE, and use it thereafter. Then I tried to put this in a.boot.js
file and an issue pops up: the writable characteristic callsonWrite
twice each time a message arrives.So I thought its because
setServices
is called multiple times (e.g. after long-press BTN3), but even the following doesn't solve it:When I run its parts individually, everything works (e.g. first
has_service
returns false, thensetServices
, thenhas_service
returns true) and I get oneonWrite
per message. When I do a hard reset with this in the boot file and write to the characteristic,onWrite
gets called twice.It would be great if anyone could shed some light on this :)
edit:
.t
is 1Beta Was this translation helpful? Give feedback.
All reactions