I've never seen an error 13313 before! If you can get something simple that reproduces it then I'll see what I can do to fix it though.
For the order of setAdvertising/setServices and sleep/wake - it shouldn't matter. If they're set up when in sleep, it should just apply when you wake. Internally, if the device is 'awake', setAdvertising actually calls sleep, sets up advertising, then calls wake - so it should be fine either way.
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.
I've never seen an error 13313 before! If you can get something simple that reproduces it then I'll see what I can do to fix it though.
For the order of setAdvertising/setServices and sleep/wake - it shouldn't matter. If they're set up when in
sleep
, it should just apply when youwake
. Internally, if the device is 'awake',setAdvertising
actually callssleep
, sets up advertising, then callswake
- so it should be fine either way.