It's really strange about your error 8 - I guess it must have been something in the saved code.
I think I need to come up with a better way of handling the 'save on send' thing - it seems a lot of people are hitting problems when turning it on, uploading, then trying to do things after it's turned off if the existing code is still saved.
It definitely looks like there's some issue with wake, sleep and setAdvertising as you say. sleep and wakeshould do what you want (stopping advertising) but I bet there are some checks missing in there (maybe calling sleep or wake while connected?). They tend not to be used that much so I haven't focussed on them as much as I should - I'll see if I can find a way to reproduce it here as well.
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.
It's really strange about your error 8 - I guess it must have been something in the saved code.
I think I need to come up with a better way of handling the 'save on send' thing - it seems a lot of people are hitting problems when turning it on, uploading, then trying to do things after it's turned off if the existing code is still saved.
It definitely looks like there's some issue with
wake
,sleep
andsetAdvertising
as you say.sleep
andwake
should do what you want (stopping advertising) but I bet there are some checks missing in there (maybe callingsleep
orwake
while connected?). They tend not to be used that much so I haven't focussed on them as much as I should - I'll see if I can find a way to reproduce it here as well.