The challenge is that the touchscreen itself draws quite a lot of power when it's on. You can't really leave it on all the time or it'll drain the battery over the course of a week or so.
So there's now this idea of 'locking'. When the device is locked the lock icon appears and the touchscreen is turned off. You can do Bangle.setLocked(false) as well as Bangle.setOptions({lockTimeout:0}) (http://www.espruino.com/Reference#t_l_Bangle_setOptions) to force the touchscreen to be enabled all the time.
However then touches go through to apps all the time.
I guess the ideal solution might be to use the accelerometer for tap detection. It has something built-in, but right now it seems badly calibrated:
Bangle.on('tap',function(t) {
print(t); // for debugging
if (t.double) Bangle.setLocked(0);
})
Bangle.accelWr(0x1E,[0x3F]); // enable tap detect
Even so you seem to be able to unlock it pretty well by just tapping twice (about the speed you'd say 'one two' - not too quick).
I think the TDTC, TTH, TTL, FTD, STD, TLT and TWS values could do with some fine tuning though - maybe making it less sensitive but then more able to detect faster double taps.
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.
Ahh, yes, it's a bit more confusing now.
The challenge is that the touchscreen itself draws quite a lot of power when it's on. You can't really leave it on all the time or it'll drain the battery over the course of a week or so.
So there's now this idea of 'locking'. When the device is locked the lock icon appears and the touchscreen is turned off. You can do
Bangle.setLocked(false)
as well asBangle.setOptions({lockTimeout:0})
(http://www.espruino.com/Reference#t_l_Bangle_setOptions) to force the touchscreen to be enabled all the time.However then touches go through to apps all the time.
I guess the ideal solution might be to use the accelerometer for tap detection. It has something built-in, but right now it seems badly calibrated:
Even so you seem to be able to unlock it pretty well by just tapping twice (about the speed you'd say 'one two' - not too quick).
I think the TDTC, TTH, TTL, FTD, STD, TLT and TWS values could do with some fine tuning though - maybe making it less sensitive but then more able to detect faster double taps.
More info at https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf - you can just use
Bangle.accelWr
to poke the relevant values