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 calls onWrite 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, then setServices, then has_service returns true) and I get one onWrite 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 :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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 1