mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
remove #if 0, lock when screen off improve logic, tap direction fix bangle1 only.
This commit is contained in:
parent
8fc0652354
commit
4171de95db
@ -1434,12 +1434,9 @@ void peripheralPollHandler() {
|
||||
jswrap_banglejs_setLocked(false);
|
||||
inactivityTimer = 0;
|
||||
}
|
||||
// if (!(bangleFlags & JSBF_LOCKED)) {
|
||||
// Pierce Lock + Wake Not Consume
|
||||
faceUpSent = true;
|
||||
bangleTasks |= JSBT_FACE_UP;
|
||||
jshHadEvent();
|
||||
// }
|
||||
faceUpSent = true;
|
||||
bangleTasks |= JSBT_FACE_UP;
|
||||
jshHadEvent();
|
||||
}
|
||||
// Step counter
|
||||
if (bangleTasks & JSBT_ACCEL_INTERVAL_DEFAULT) {
|
||||
@ -1470,11 +1467,9 @@ void peripheralPollHandler() {
|
||||
if (tdy<-tthresh && twistTimer<twistTimeout && acc.y<twistMaxY) {
|
||||
twistTimer = TIMER_MAX; // ensure we don't trigger again until tdy>tthresh
|
||||
|
||||
// if (!(bangleFlags & JSBF_LOCKED)) {
|
||||
// Pierce LOCK. Wake doesn't Consume Event.
|
||||
bangleTasks |= JSBT_TWIST_EVENT;
|
||||
jshHadEvent();
|
||||
// }
|
||||
|
||||
if (bangleFlags&JSBF_WAKEON_TWIST) {
|
||||
inactivityTimer = 0;
|
||||
@ -1959,8 +1954,7 @@ void jswrap_banglejs_setLCDPowerBacklight(bool isOn) {
|
||||
bangleFlags |= JSBF_LCD_BL_ON;
|
||||
}
|
||||
else {
|
||||
int dur = lockTimeout - backlightTimeout;
|
||||
if ( dur == 0 ) jswrap_banglejs_setLocked(true);
|
||||
if (lockTimeout > 0 && lockTimeout <= backlightTimeout) jswrap_banglejs_setLocked(true);
|
||||
bangleFlags &= ~JSBF_LCD_BL_ON;
|
||||
}
|
||||
#ifndef EMULATED
|
||||
@ -1997,14 +1991,6 @@ void jswrap_banglejs_setLCDPowerBacklight(bool isOn) {
|
||||
#endif // !EMULATED
|
||||
}
|
||||
|
||||
#if 0
|
||||
void _jswrap_bangle_lcd_lock(JsSysTime t, void *data)
|
||||
{
|
||||
uint32_t d = (uint32_t)data;
|
||||
jswrap_banglejs_setLocked((bool)d);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*JSON{
|
||||
"type" : "staticmethod",
|
||||
"class" : "Bangle",
|
||||
@ -2058,21 +2044,10 @@ void jswrap_banglejs_setLCDPower(bool isOn) {
|
||||
}
|
||||
else {
|
||||
bangleFlags &= ~JSBF_LCD_ON;
|
||||
int dur = lockTimeout - lcdPowerTimeout;
|
||||
if ( dur == 0 ) jswrap_banglejs_setLocked(true);
|
||||
#if 0
|
||||
else if (dur > 0) {
|
||||
uint32_t d = 1; // lock in
|
||||
JsSysTime time = jshGetSystemTime();
|
||||
jstExecuteFn(_jswrap_bangle_lcd_lock, d, jshGetTimeFromMilliseconds(time), 0, NULL);
|
||||
}
|
||||
#endif
|
||||
if (lockTimeout > 0 && lockTimeout <= lcdPowerTimeout) jswrap_banglejs_setLocked(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*JSON{
|
||||
"type" : "staticmethod",
|
||||
"class" : "Bangle",
|
||||
@ -4036,15 +4011,16 @@ bool jswrap_banglejs_idle() {
|
||||
if (tapInfo&1) string="back";
|
||||
if (tapInfo&8) string="bottom";
|
||||
if (tapInfo&4) string="top";
|
||||
if (tapInfo&16) string="right";
|
||||
if (tapInfo&32) string="left";
|
||||
#else
|
||||
if (tapInfo&1) string="front";
|
||||
if (tapInfo&2) string="back";
|
||||
if (tapInfo&4) string="top";
|
||||
if (tapInfo&8) string="bottom";
|
||||
#endif
|
||||
|
||||
if (tapInfo&16) string="left";
|
||||
if (tapInfo&32) string="right";
|
||||
#endif
|
||||
int n = (tapInfo&0x80)?2:1;
|
||||
jsvObjectSetChildAndUnLock(o, "dir", jsvNewFromString(string));
|
||||
jsvObjectSetChildAndUnLock(o, "double", jsvNewFromBool(tapInfo&0x80));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user