Merge pull request #1518 from Stiralbios/master

TerminalClock: Change Activity to Motion
pull/1529/head
Gordon Williams 2022-02-28 10:02:30 +00:00 committed by GitHub
commit 0694603831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Rename "Activity" in "Motion" and display the true values for it

View File

@ -5,5 +5,5 @@ It can display :
- time
- date
- hrm
- activity
- motion
- steps

View File

@ -1,6 +1,5 @@
var locale = require("locale");
var fontColor = g.theme.dark ? "#0f0" : "#000";
var startY = 24;
var paddingY = 2;
var font6x8At4Size = 32;
var font6x8At2Size = 18;
@ -15,25 +14,25 @@ function setFontSize(pos){
}
function clearField(pos){
var yStartPos = startY +
var yStartPos = Bangle.appRect.y +
paddingY * (pos - 1) +
font6x8At4Size * Math.min(1, pos-1) +
font6x8At2Size * Math.max(0, pos-2);
var yEndPos = startY +
var yEndPos = Bangle.appRect.y +
paddingY * (pos - 1) +
font6x8At4Size * Math.min(1, pos) +
font6x8At2Size * Math.max(0, pos-1);
g.clearRect(0, yStartPos, 240, yEndPos);
g.clearRect(Bangle.appRect.x, yStartPos, Bangle.appRect.x2, yEndPos);
}
function clearWatchIfNeeded(now){
if(now.getMinutes() % 10 == 0)
g.clearRect(0, startY, 240, 240);
g.clearRect(Bangle.appRect.x, Bangle.appRect.y, Bangle.appRect.x2, Bangle.appRect.y2);
}
function drawLine(line, pos){
setFontSize(pos);
var yPos = startY +
var yPos = Bangle.appRect.y +
paddingY * (pos - 1) +
font6x8At4Size * Math.min(1, pos-1) +
font6x8At2Size * Math.max(0, pos-2);
@ -76,11 +75,10 @@ function drawHRM(pos){
function drawActivity(pos){
clearField(pos);
var health = Bangle.getHealthStatus('last');
var steps_formated = ">Activity: " + parseInt(health.movement/10);
var steps_formated = ">Motion: " + parseInt(health.movement);
drawLine(steps_formated, pos);
}
function draw(){
var curPos = 1;
g.reset();
@ -109,7 +107,6 @@ function draw(){
drawInput(now, curPos);
}
Bangle.on('HRM',function(hrmInfo) {
if(hrmInfo.confidence >= settings.HRMinConfidence)
heartRate = hrmInfo.bpm;
@ -127,12 +124,12 @@ var settings = Object.assign({
showActivity: true,
showStepCount: true,
}, require('Storage').readJSON("terminalclock.json", true) || {});
// draw immediately at first
draw();
// Show launcher when middle button pressed
Bangle.setUI("clock");
// Load widgets
Bangle.loadWidgets();
Bangle.drawWidgets();
// draw immediately at first
draw();
var secondInterval = setInterval(draw, 10000);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB