I have a puck running a simple script that is set to advertise every 2000 ms. There is a timeout set that checks battery every 10 minutes, attaches the value to the name of the device so I can see the status of puck's battery by using a BLE scanner on my phone.
I am not sure why but sometimes (after days) the advertising string doesn't change anymore (or keeps being empty), puck is still advertising, but the script is obviously not working anymore.
I believe this is because of some script error that breaks the 10 minutes routine.
So I would like to put the code in some "try-catch" loop that restarts the whole thing in case something odd happens. How to?
Thank you!
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 have a puck running a simple script that is set to advertise every 2000 ms. There is a timeout set that checks battery every 10 minutes, attaches the value to the name of the device so I can see the status of puck's battery by using a BLE scanner on my phone.
I am not sure why but sometimes (after days) the advertising string doesn't change anymore (or keeps being empty), puck is still advertising, but the script is obviously not working anymore.
I believe this is because of some script error that breaks the 10 minutes routine.
So I would like to put the code in some "try-catch" loop that restarts the whole thing in case something odd happens. How to?
Thank you!