Add option for ISO 8601 date
parent
f0ee2be3db
commit
e8642e7f41
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
A clock displayed as a terminal cli.
|
A clock displayed as a terminal cli.
|
||||||
It can display:
|
It can display:
|
||||||
|
|
||||||
- time
|
- time
|
||||||
- date
|
- date
|
||||||
- altitude
|
- altitude
|
||||||
|
|
@ -9,7 +10,6 @@ It can display :
|
||||||
- motion
|
- motion
|
||||||
- steps
|
- steps
|
||||||
|
|
||||||
|
|
||||||
"Power saving" setting control the HR and pressure (altitude) sensors.
|
"Power saving" setting control the HR and pressure (altitude) sensors.
|
||||||
If "Off" they will always be on.
|
If "Off" they will always be on.
|
||||||
If "On" the sensors will be turned on every "Power on interval" minutes for 45 secondes
|
If "On" the sensors will be turned on every "Power on interval" minutes for 45 seconds
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
curPos++;
|
curPos++;
|
||||||
|
|
||||||
["L2", "L3", "L4", "L5", "L6", "L7", "L8", "L9"].forEach(line => {
|
["L2", "L3", "L4", "L5", "L6", "L7", "L8", "L9"].forEach(line => {
|
||||||
if (this[line]==='Date') drawDate(date, curPos);
|
if (this[line]==='Date') drawDate(date, this.isoDate, curPos);
|
||||||
else if (this[line]==='HR') drawHRM(curPos);
|
else if (this[line]==='HR') drawHRM(curPos);
|
||||||
else if (this[line]==='Motion') drawMotion(curPos);
|
else if (this[line]==='Motion') drawMotion(curPos);
|
||||||
else if (this[line]==='Alt') drawAltitude(curPos);
|
else if (this[line]==='Alt') drawAltitude(curPos);
|
||||||
|
|
@ -101,10 +101,11 @@
|
||||||
-------------------------------- */
|
-------------------------------- */
|
||||||
|
|
||||||
let drawLine = function(line, pos) {
|
let drawLine = function(line, pos) {
|
||||||
if(pos == 1)
|
if (pos == 1) {
|
||||||
g.setFont("6x8", font6x8FirstTextSize);
|
g.setFont("6x8", font6x8FirstTextSize);
|
||||||
else
|
} else {
|
||||||
g.setFont("6x8", font6x8DefaultTextSize);
|
g.setFont("6x8", font6x8DefaultTextSize);
|
||||||
|
}
|
||||||
|
|
||||||
let yPos = Bangle.appRect.y +
|
let yPos = Bangle.appRect.y +
|
||||||
paddingY * (pos - 1) +
|
paddingY * (pos - 1) +
|
||||||
|
|
@ -120,11 +121,19 @@
|
||||||
drawLine(time, pos);
|
drawLine(time, pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawDate = function(now, pos){
|
let drawDate = function(now, isoDate, pos) {
|
||||||
|
let date;
|
||||||
|
if (clock.isoDate) {
|
||||||
|
let year = now.getFullYear();
|
||||||
|
let month = now.getMonth() + 1; // Months are 0-11
|
||||||
|
let day = now.getDate();
|
||||||
|
date = ">" + year + "-" + month + "-" + day;
|
||||||
|
} else {
|
||||||
let dow = locale.dow(now, 1);
|
let dow = locale.dow(now, 1);
|
||||||
let date = locale.date(now, 1).substr(0,6) + locale.date(now, 1).substr(-2);
|
date = locale.date(now, 1).substr(0,6) + locale.date(now, 1).substr(-2);
|
||||||
let locale_date = ">" + dow + " " + date;
|
date = ">" + dow + " " + date;
|
||||||
drawLine(locale_date, pos);
|
}
|
||||||
|
drawLine(date, pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawInput = function(pos) {
|
let drawInput = function(pos) {
|
||||||
|
|
@ -138,19 +147,21 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawHRM = function(pos) {
|
let drawHRM = function(pos) {
|
||||||
if(heartRate != 0)
|
if (heartRate != 0) {
|
||||||
drawLine(">HR: " + parseInt(heartRate), pos);
|
drawLine(">HR: " + parseInt(heartRate), pos);
|
||||||
else
|
} else {
|
||||||
drawLine(
|
drawLine(
|
||||||
">HR: " + parseInt(Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm)),
|
">HR: " + parseInt(Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm)),
|
||||||
pos);
|
pos);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawAltitude = function(pos) {
|
let drawAltitude = function(pos) {
|
||||||
if(altitude > 0)
|
if (altitude > 0) {
|
||||||
drawLine(">Alt: " + altitude.toFixed(1) + "m", pos);
|
drawLine(">Alt: " + altitude.toFixed(1) + "m", pos);
|
||||||
else
|
} else {
|
||||||
drawLine(">Alt: unknown", pos);
|
drawLine(">Alt: unknown", pos);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let drawMotion = function(pos) {
|
let drawMotion = function(pos) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Terminal Clock",
|
"name": "Terminal Clock",
|
||||||
"shortName":"Terminal Clock",
|
"shortName":"Terminal Clock",
|
||||||
"description": "A terminal cli like clock displaying multiple sensor data",
|
"description": "A terminal cli like clock displaying multiple sensor data",
|
||||||
"version":"0.10",
|
"version":"0.11",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
// Load settings
|
// Load settings
|
||||||
var settings = Object.assign({
|
var settings = Object.assign({
|
||||||
// TerminalClock specific
|
// TerminalClock specific
|
||||||
|
isoDate: false,
|
||||||
HRMinConfidence: 50,
|
HRMinConfidence: 50,
|
||||||
PowerOnInterval: 15,
|
PowerOnInterval: 15,
|
||||||
L2: 'Date',
|
L2: 'Date',
|
||||||
|
|
@ -72,6 +73,13 @@
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ISO date": {
|
||||||
|
value: !!settings.isoDate,
|
||||||
|
onchange: v => {
|
||||||
|
settings.isoDate = v;
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const save = (key, v) => {
|
const save = (key, v) => {
|
||||||
settings[key] = v;
|
settings[key] = v;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue