mirror of https://github.com/espruino/BangleApps
support banglejs2
parent
25cabc80ef
commit
5453ef719d
|
@ -6,7 +6,7 @@
|
||||||
"description": "Make sure you wake up! Count to the right number to turn off the alarm",
|
"description": "Make sure you wake up! Count to the right number to turn off the alarm",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,alarm,widget",
|
"tags": "tool,alarm,widget",
|
||||||
"supports": ["BANGLEJS"],
|
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"hardalarm.app.js","url":"app.js"},
|
{"name":"hardalarm.app.js","url":"app.js"},
|
||||||
{"name":"hardalarm.boot.js","url":"boot.js"},
|
{"name":"hardalarm.boot.js","url":"boot.js"},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const HARDWARE_VERSION = process.env.HWVERSION;
|
||||||
|
|
||||||
const timeWidth = 42;
|
const timeWidth = 42;
|
||||||
const screenWidth = 239;
|
const screenWidth = 239;
|
||||||
const screenHeight = 239;
|
const screenHeight = 239;
|
||||||
|
@ -627,41 +629,82 @@ function lookCurrent() {
|
||||||
lookBack = true;
|
lookBack = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
setWatch(() => {
|
if (HARDWARE_VERSION == 1) {
|
||||||
var timeAhead = 3600000 * 12;
|
setWatch(() => {
|
||||||
if(quoteId >= quotes.length - 1) {
|
|
||||||
quoteId = 0;
|
|
||||||
} else {
|
|
||||||
quoteId = quoteId + 1;
|
|
||||||
}
|
|
||||||
if(!lookingDate) {
|
|
||||||
lookingDate = new Date();
|
|
||||||
}
|
|
||||||
lookingDate = new Date(lookingDate.getTime() + timeAhead);
|
|
||||||
printTime(lookingDate, false);
|
|
||||||
if(timeout) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
timeout = setTimeout(()=>lookCurrent(), 3000);
|
|
||||||
}, BTN1, { repeat: true, edge: "falling" });
|
|
||||||
|
|
||||||
setWatch(() => {
|
var timeBehind = 3600000 * 12;
|
||||||
|
if(quoteId <= 0) {
|
||||||
|
quoteId = quotes.length - 1;
|
||||||
|
} else {
|
||||||
|
quoteId = quoteId - 1;
|
||||||
|
}
|
||||||
|
if(!lookingDate) {
|
||||||
|
lookingDate = new Date();
|
||||||
|
}
|
||||||
|
lookingDate = new Date(lookingDate.getTime() - timeBehind);
|
||||||
|
printTime(lookingDate, false);
|
||||||
|
if(timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
timeout = setTimeout(()=>lookCurrent(), 6000);
|
||||||
|
}, BTN2, { repeat: true, edge: "falling" });
|
||||||
|
|
||||||
var timeBehind = 3600000 * 12;
|
setWatch(() => {
|
||||||
if(quoteId <= 0) {
|
var timeAhead = 3600000 * 12;
|
||||||
quoteId = quotes.length - 1;
|
if(quoteId >= quotes.length - 1) {
|
||||||
} else {
|
quoteId = 0;
|
||||||
quoteId = quoteId - 1;
|
} else {
|
||||||
}
|
quoteId = quoteId + 1;
|
||||||
if(!lookingDate) {
|
}
|
||||||
lookingDate = new Date();
|
if(!lookingDate) {
|
||||||
}
|
lookingDate = new Date();
|
||||||
lookingDate = new Date(lookingDate.getTime() - timeBehind);
|
}
|
||||||
printTime(lookingDate, false);
|
lookingDate = new Date(lookingDate.getTime() + timeAhead);
|
||||||
if(timeout) {
|
printTime(lookingDate, false);
|
||||||
clearTimeout(timeout);
|
if(timeout) {
|
||||||
}
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(()=>lookCurrent(), 3000);
|
}
|
||||||
}, BTN3, { repeat: true, edge: "falling" });
|
timeout = setTimeout(()=>lookCurrent(), 6000);
|
||||||
|
}, BTN3, { repeat: true, edge: "falling" });
|
||||||
|
}
|
||||||
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
let onSwipe = (x, y) => {
|
||||||
|
if (x == -1) {
|
||||||
|
var timeBehind = 3600000 * 1;
|
||||||
|
if(quoteId <= 0) {
|
||||||
|
quoteId = quotes.length - 1;
|
||||||
|
} else {
|
||||||
|
quoteId = quoteId - 1;
|
||||||
|
}
|
||||||
|
if(!lookingDate) {
|
||||||
|
lookingDate = new Date();
|
||||||
|
}
|
||||||
|
lookingDate = new Date(lookingDate.getTime() - timeBehind);
|
||||||
|
printTime(lookingDate, false);
|
||||||
|
if(timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
timeout = setTimeout(()=>lookCurrent(), 6000);
|
||||||
|
}
|
||||||
|
else if (x == 1) {
|
||||||
|
var timeAhead = 3600000 * 1;
|
||||||
|
if(quoteId >= quotes.length - 1) {
|
||||||
|
quoteId = 0;
|
||||||
|
} else {
|
||||||
|
quoteId = quoteId + 1;
|
||||||
|
}
|
||||||
|
if(!lookingDate) {
|
||||||
|
lookingDate = new Date();
|
||||||
|
}
|
||||||
|
lookingDate = new Date(lookingDate.getTime() + timeAhead);
|
||||||
|
printTime(lookingDate, false);
|
||||||
|
if(timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
timeout = setTimeout(()=>lookCurrent(), 6000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Bangle.on("swipe", onSwipe);
|
||||||
|
|
||||||
|
setWatch(Bangle.showLauncher, BTN, { repeat: false, edge: "falling" });
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
{"name":"twentyeightbysix.app.js","url":"app.js"},
|
{"name":"twentyeightbysix.app.js","url":"app.js"},
|
||||||
{"name":"twentyeightbysix.img","url":"app-icon.js","evaluate":true}
|
{"name":"twentyeightbysix.img","url":"app-icon.js","evaluate":true}
|
||||||
],
|
],
|
||||||
"supports": ["BANGLEJS"]
|
"supports": ["BANGLEJS", "BANGLEJS2"]
|
||||||
}
|
}
|
Loading…
Reference in New Issue