mirror of https://github.com/espruino/BangleApps
misc app tweaks
parent
34228a84d9
commit
f382c8b68f
|
@ -54,7 +54,7 @@
|
|||
{ "id": "about",
|
||||
"name": "About",
|
||||
"icon": "app.png",
|
||||
"version":"0.07",
|
||||
"version":"0.08",
|
||||
"description": "Bangle.js About page - showing software version, stats, and a collaborative mural from the Bangle.js KickStarter backers",
|
||||
"tags": "tool,system",
|
||||
"allow_emulator":true,
|
||||
|
@ -665,7 +665,7 @@
|
|||
{ "id": "hrm",
|
||||
"name": "Heart Rate Monitor",
|
||||
"icon": "heartrate.png",
|
||||
"version":"0.03",
|
||||
"version":"0.04",
|
||||
"description": "Measure your heart rate and see live sensor data",
|
||||
"tags": "health",
|
||||
"storage": [
|
||||
|
@ -860,7 +860,7 @@
|
|||
{ "id": "s7clk",
|
||||
"name": "Simple 7 segment Clock",
|
||||
"icon": "icon.png",
|
||||
"version":"0.04",
|
||||
"version":"0.02",
|
||||
"description": "A simple 7 segment Clock with date",
|
||||
"tags": "clock",
|
||||
"type":"clock",
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
0.05: Actual pixels as of 27 Apr 2020
|
||||
0.06: Actual pixels as of 12 Jun 2020
|
||||
0.07: Pressing a button now exits immediately (fix #618)
|
||||
0.08: Make about (mostly) work on non-240px screens
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
|||
0.01: New App!
|
||||
0.02: Use HRM data and calculations from Bangle.js (don't access hardware directly)
|
||||
0.03: Fix timing issues, and use 1/2 scale to keep graph on screen
|
||||
0.04: Update for new firmwares that have a 'HRM-raw' event
|
||||
|
|
|
@ -4,18 +4,25 @@ Bangle.setHRMPower(1);
|
|||
var hrmInfo, hrmOffset = 0;
|
||||
var hrmInterval;
|
||||
function onHRM(h) {
|
||||
// this is the first time we're called
|
||||
if (counter!==undefined) {
|
||||
// the first time we're called remove
|
||||
// the countdown
|
||||
counter = undefined;
|
||||
g.clear();
|
||||
}
|
||||
hrmInfo = h;
|
||||
hrmOffset = 0;
|
||||
/* On 2v09 and earlier firmwares the only solution for realtime
|
||||
HRM was to look at the 'raw' array that got reported. If you timed
|
||||
it right you could grab the data pretty much as soon as it was written.
|
||||
In new firmwares, '.raw' is not available. */
|
||||
if (hrmInterval) clearInterval(hrmInterval);
|
||||
hrmInterval = undefined;
|
||||
if (hrmInfo.raw) {
|
||||
hrmOffset = 0;
|
||||
setTimeout(function() {
|
||||
hrmInterval = setInterval(readHRM,41);
|
||||
}, 40);
|
||||
}
|
||||
|
||||
var px = g.getWidth()/2;
|
||||
g.setFontAlign(0,0);
|
||||
|
@ -28,13 +35,32 @@ function onHRM(h) {
|
|||
g.drawString("BPM",px+15,45);
|
||||
}
|
||||
Bangle.on('HRM', onHRM);
|
||||
/* On newer (2v10) firmwares we can subscribe to get
|
||||
HRM events as they happen */
|
||||
Bangle.on('HRM-raw', function(v) {
|
||||
var a = v.raw;
|
||||
hrmOffset++;
|
||||
if (hrmOffset>g.getWidth()) {
|
||||
hrmOffset=0;
|
||||
g.clearRect(0,90,239,239);
|
||||
g.moveTo(-100,0);
|
||||
}
|
||||
|
||||
y = E.clip(170 - (v.raw*2),100,230);
|
||||
g.setColor(1,1,1);
|
||||
g.lineTo(hrmOffset, y);
|
||||
});
|
||||
|
||||
// It takes 5 secs for us to get the first HRM event
|
||||
var counter = 5;
|
||||
function countDown() {
|
||||
E.showMessage("Please wait...\n"+counter--);
|
||||
if (counter) setTimeout(countDown, 1000);
|
||||
if (counter) {
|
||||
g.drawString(counter--,g.getWidth()/2,g.getHeight()/2, true);
|
||||
setTimeout(countDown, 1000);
|
||||
}
|
||||
}
|
||||
g.clear().setFont("6x8",2).setFontAlign(0,0);
|
||||
g.drawString("Please wait...",g.getWidth()/2,g.getHeight()/2 - 16);
|
||||
countDown();
|
||||
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: Tweaks for Q3 watch
|
||||
|
|
|
@ -16,11 +16,12 @@ function draw() {
|
|||
g.drawString(("0"+d.getSeconds()).substr(-2),x+size*18,y + size*7);
|
||||
// date
|
||||
var s = d.toString().split(" ").slice(0,4).join(" ");
|
||||
g.reset().setFontAlign(0,-1);
|
||||
g.setFont("6x8").setFontAlign(0,-1);
|
||||
g.drawString(s,g.getWidth()/2, y + size*12);
|
||||
}
|
||||
|
||||
// Only update when display turns on
|
||||
if (process.env.BOARD!="SMAQ3") // hack for Q3 which is always-on
|
||||
Bangle.on('lcdPower', function(on) {
|
||||
if (secondInterval)
|
||||
clearInterval(secondInterval);
|
||||
|
|
Loading…
Reference in New Issue