Have you tried NRF.setLowPowerConnection(true)?
Realistically it'll be the actual HID connection to the computer that sucks all the power, rather than the advertising. setLowPowerConnection modifies the connection interval so next time you connect it's only polling twice a second rather than ~50 times a second.
Worrying about the NRF.wake causing a reset - I wonder - is it possible it's being called when you already have a BLE connection? It basically enables advertising, but you can't advertise when connected so I wonder if I've actually accounted for that.
I'd give it a shot with all the wake/sleep/disconnect stuff removed, and just with setLowPowerConnection - I reckon that should make a massive difference.
© Espruino, powered by microcosm.
Report a problem