Replaced by https://github.com/tomgidden/page-turn-o-matic
Please make forks, improvements, pull requests there if you can improve on my work!
Replaced by https://github.com/tomgidden/page-turn-o-matic
Please make forks, improvements, pull requests there if you can improve on my work!
This new commit (5) is back to basics (again). It just does an NRF.disconnect()
, which should perform NRF.sleep()
. It doesn't mess with advertising or anything. It seems to work.
Problems with multiple events led to encapsulating the entire thing in init
, adding E.removeAllListeners()
and NRF.removeAllListeners()
, clearWatch()
, etc.
Serial console helped diagnose some issues, but also heisenberged it a bit.
Seems to work now; going to try battery usage again next.
As mentioned in the comment, this is currently broken on both my pucks.
Gordon's suggestions incl.
setLowPowerConnection(true)
: this decreases the frequency of polling of the puck by the computer from 50Hz to <1Hz. However, it makes debugging hard and messes with the double-click, so it's currently disabled.The alternative is to modify the advertisement. That's what's probably causing (or at least, catalyzing) the
NRF ERROR 0x8
.NRF.sleep()
andNRF.wake()
play with advertisement; I think the key is understanding how the process works (which I'm currently getting to grips with)Getting the tablet/desktop to stop listening is a problem; as this works by polling, the process is largely one way. The tablet must listen (connect and then wait for advertisement) if it is to resume clicking. I'm not sure how best to get this going. I wonder if the book might help... hmm.