mirror of https://github.com/espruino/BangleApps
improved display in kitchen/stopwatch, updated README files
parent
6f002cd2a6
commit
2644f2226d
|
@ -3029,7 +3029,7 @@
|
|||
"name": "Stepometer Clock",
|
||||
"icon": "stepo.png",
|
||||
"version":"0.03",
|
||||
"description": "A large font watch, displays step count in a doughnut guage and warns of low battery",
|
||||
"description": "A large font watch, displays step count in a doughnut guage and warns of low battery, requires one of the steps widgets to be installed",
|
||||
"tags": "clock",
|
||||
"type":"clock",
|
||||
"readme": "README.md",
|
||||
|
@ -3083,7 +3083,7 @@
|
|||
{ "id": "kitchen",
|
||||
"name": "Kitchen Combo",
|
||||
"icon": "kitchen.png",
|
||||
"version":"0.04",
|
||||
"version":"0.05",
|
||||
"description": "Combination of the stepo, walkersclock, arrow and waypointer apps into a multiclock format. 'Everything but the kitchen sink'. Requires firmware v2.08.167 or later",
|
||||
"tags": "tool,outdoors,gps",
|
||||
"type":"clock",
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
0.02: compass disable BTN1,BTN2 while waiting for GPS to reach RUNNING status
|
||||
0.03: Don't buzz for GPS fix in Quiet Mode
|
||||
0.04: Added stopwatch face
|
||||
0.05: Stopwatch, hide hours if 0, fixed flicker when stopped, updated README issues
|
||||
|
|
|
@ -207,4 +207,8 @@ is recorded in a storage file named `magnav.json`.
|
|||
* GPS time display shows GMT and not BST, needs localising
|
||||
* Occassional buzzing after 2-3 days of use, seems to disappear after
|
||||
a reset to the launcher menu. Needs investigation
|
||||
* Stopwatch display to hide hours count if elapsed time is less than 1 hour.
|
||||
* Need to gracefully handle incorrect firmware
|
||||
* Need to gracefully handle missing compass calibration data
|
||||
* Need to gracefully handle missing steps widget
|
||||
* Need to improve memory management for compass widget
|
||||
|
||||
|
|
|
@ -488,6 +488,7 @@ function STOPWATCH() {
|
|||
this.displayInterval;
|
||||
this.redrawButtons = true;
|
||||
this.redrawLaps = true;
|
||||
this.redrawTime = true;
|
||||
}
|
||||
|
||||
STOPWATCH.prototype.log_debug = function(o) {
|
||||
|
@ -498,8 +499,13 @@ STOPWATCH.prototype.timeToText = function(t) {
|
|||
let hrs = Math.floor(t/3600000);
|
||||
let mins = Math.floor(t/60000)%60;
|
||||
let secs = Math.floor(t/1000)%60;
|
||||
let text;
|
||||
|
||||
if (hrs === 0)
|
||||
text = ("0"+mins).substr(-2) + ":" + ("0"+secs).substr(-2);
|
||||
else
|
||||
text = (""+hrs) + ":" + ("0"+mins).substr(-2) + ":" + ("0"+secs).substr(-2);
|
||||
|
||||
let text = ("00"+hrs).substr(-3) + ":" + ("0"+mins).substr(-2) + ":" + ("0"+secs).substr(-2);
|
||||
this.log_debug(text);
|
||||
return text;
|
||||
}
|
||||
|
@ -520,7 +526,7 @@ STOPWATCH.prototype.stopStart = function() {
|
|||
this.tCurrent = Date.now();
|
||||
this.redrawButtons = true;
|
||||
this.redrawLaps = true;
|
||||
|
||||
this.redrawTime = true;
|
||||
this.draw();
|
||||
}
|
||||
|
||||
|
@ -529,7 +535,7 @@ STOPWATCH.prototype.lap = function() {
|
|||
if (this.running) {
|
||||
this.tCurrent = Date.now();
|
||||
this.lapTimes.unshift(this.tCurrent - this.tStart);
|
||||
console.log(this.tCurrent - this.tStart);
|
||||
log_debug(this.tCurrent - this.tStart);
|
||||
}
|
||||
|
||||
this.tStart = this.tCurrent;
|
||||
|
@ -552,6 +558,7 @@ STOPWATCH.prototype.reset = function() {
|
|||
STOPWATCH.prototype.lapOrReset = function() {
|
||||
this.redrawButtons = true;
|
||||
this.redrawLaptimes = true;
|
||||
this.redrawTime = true;
|
||||
|
||||
this.log_debug("lapReset()");
|
||||
if (this.running)
|
||||
|
@ -566,7 +573,7 @@ STOPWATCH.prototype.draw = function() {
|
|||
|
||||
g.setColor(1,1,1);
|
||||
if (this.redrawButtons) this.drawButtons();
|
||||
this.drawTime();
|
||||
if (this.running || this.redrawTime) this.drawTime();
|
||||
if (this.redrawLaps) this.drawLaptimes();
|
||||
}
|
||||
|
||||
|
@ -597,33 +604,34 @@ STOPWATCH.prototype.drawLaptimes = function() {
|
|||
|
||||
STOPWATCH.prototype.drawTime = function() {
|
||||
this.log_debug("drawTime()");
|
||||
let t = this.tCurrent - this.tStart;
|
||||
let Tt = this.tCurrent - this.tTotal;
|
||||
|
||||
let txt = this.timeToText(t);
|
||||
let Ttxt = this.timeToText(Tt);
|
||||
|
||||
let x = 100;
|
||||
let Tx = 125;
|
||||
let tLap = this.tCurrent - this.tStart;
|
||||
let tTotal = this.tCurrent - this.tTotal;
|
||||
let txtLap = this.timeToText(tLap);
|
||||
let txtTotal = this.timeToText(tTotal);
|
||||
let xTotal = 100;
|
||||
let xLap = 125;
|
||||
|
||||
// total time
|
||||
g.setFont("Vector",38);
|
||||
g.setFontAlign(0,0);
|
||||
g.clearRect(0,this.timeY-21,200,this.timeY+21);
|
||||
g.clearRect(0, this.timeY-21, 200, this.timeY+21);
|
||||
g.setColor(0xFFC0);
|
||||
g.drawString(Ttxt,x,this.timeY);
|
||||
g.drawString(txtTotal, xTotal, this.timeY);
|
||||
|
||||
// current lap time
|
||||
g.setFont("Vector", 20);
|
||||
g.clearRect(0, this.TtimeY-7,200, this.TtimeY+7);
|
||||
g.clearRect(0, this.TtimeY-7, 200, this.TtimeY+7);
|
||||
g.setColor(1,1,1);
|
||||
g.drawString(txt,Tx, this.TtimeY);
|
||||
g.drawString(txtLap, xLap, this.TtimeY);
|
||||
|
||||
this.redrawTime = false;
|
||||
}
|
||||
|
||||
STOPWATCH.prototype.startTimer = function() {
|
||||
this.log_debug("startTimer()");
|
||||
this.redrawButtons = true;
|
||||
this.redrawLaps = true;
|
||||
this.redrawTime = true;
|
||||
this.draw();
|
||||
this.displayInterval = setInterval(stopwatchDraw, 1000);
|
||||
}
|
||||
|
|
|
@ -2,36 +2,18 @@
|
|||
function getFace(){
|
||||
let swObject = undefined;
|
||||
|
||||
function log_debug(o) {
|
||||
//console.log(o);
|
||||
}
|
||||
|
||||
function init(gps, sw) {
|
||||
showMem("swatch init 1");
|
||||
swObject = sw;
|
||||
g.clear();
|
||||
showMem("swatch init 2");
|
||||
}
|
||||
|
||||
function freeResources() {
|
||||
showMem("swatch free 1");
|
||||
swObject = undefined;
|
||||
showMem("swatch free 2");
|
||||
}
|
||||
|
||||
function showMem(msg) {
|
||||
var val = process.memory();
|
||||
var str = msg + " " + Math.round(val.usage*100/val.total) + "%";
|
||||
log_debug(str);
|
||||
}
|
||||
function freeResources() {}
|
||||
|
||||
function startTimer() {
|
||||
log_debug("swObject.startTimer()");
|
||||
swObject.startTimer();
|
||||
}
|
||||
|
||||
function stopTimer() {
|
||||
log_debug("swObject.stopTimer()");
|
||||
swObject.stopTimer();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ A large font watch, displays step count in a doughnut guage and warns of low bat
|
|||
- The guage show percentage of steps out of a goal of 10000 steps
|
||||
|
||||
|
||||
## Dependancies
|
||||
- Requires one of the steps widgets to be installed
|
||||
|
||||
|
||||

|
||||
|
||||
|
|
Loading…
Reference in New Issue