Merge pull request #3683 from bobrippling/feat/pace-reset
pace: handle GPS skew, allow reset of time/splitsmaster
commit
cc051726cc
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New app!
|
||||
0.02: Show elapsed time on pause screen
|
||||
0.03: Avoid initial GPS skew and allow reset of time/splits
|
||||
|
|
|
|||
|
|
@ -140,10 +140,12 @@
|
|||
var totalDist = dist.getValue();
|
||||
var thisSplit = totalDist - prev.dist;
|
||||
var thisTime = exs_1.state.duration - prev.time;
|
||||
while (thisSplit > 1000) {
|
||||
splits_1.push({ dist: thisSplit, time: thisTime });
|
||||
thisTime = 0;
|
||||
thisSplit -= 1000;
|
||||
if (thisSplit > 1000) {
|
||||
if (thisTime > 0) {
|
||||
if (splits_1.length || thisTime > 1000 * 60)
|
||||
splits_1.push({ dist: thisSplit, time: thisTime });
|
||||
}
|
||||
thisSplit %= 1000;
|
||||
}
|
||||
exs_1.state.notify.dist.next -= thisSplit;
|
||||
S_1.writeJSON("pace.json", { splits: splits_1 });
|
||||
|
|
@ -172,6 +174,30 @@
|
|||
Bangle.on('twist', function () {
|
||||
Bangle.setBacklight(1);
|
||||
});
|
||||
Bangle.on('tap', function (_e) {
|
||||
if (exs_1.state.active)
|
||||
return;
|
||||
var menu = {
|
||||
"": {
|
||||
remove: function () {
|
||||
draw_1();
|
||||
},
|
||||
},
|
||||
"< Back": function () {
|
||||
Bangle.setUI();
|
||||
},
|
||||
"Zero time": function () {
|
||||
exs_1.start();
|
||||
exs_1.stop();
|
||||
Bangle.setUI();
|
||||
},
|
||||
"Clear splits": function () {
|
||||
splits_1.splice(0, splits_1.length);
|
||||
Bangle.setUI();
|
||||
},
|
||||
};
|
||||
E.showMenu(menu);
|
||||
});
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
g.clearRect(Bangle.appRect);
|
||||
|
|
|
|||
|
|
@ -184,10 +184,15 @@ exs.stats.dist.on("notify", (dist) => {
|
|||
let thisSplit = totalDist - prev.dist;
|
||||
let thisTime = exs.state.duration - prev.time;
|
||||
|
||||
while(thisSplit > 1000) {
|
||||
splits.push({ dist: thisSplit as Dist, time: thisTime as Time });
|
||||
thisTime = 0; // if we've jumped more than 1k, credit the time to the first split
|
||||
thisSplit -= 1000;
|
||||
if (thisSplit > 1000) {
|
||||
if (thisTime > 0) {
|
||||
// if we have splits, or time isn't ridiculous, store the split
|
||||
// (otherwise we're initialising GPS and it's inaccurate)
|
||||
if (splits.length || thisTime > 1000 * 60)
|
||||
splits.push({ dist: thisSplit as Dist, time: thisTime as Time });
|
||||
}
|
||||
|
||||
thisSplit %= 1000;
|
||||
}
|
||||
|
||||
// subtract <how much we're over> off the next split notify
|
||||
|
|
@ -221,6 +226,32 @@ Bangle.on('twist', () => {
|
|||
Bangle.setBacklight(1);
|
||||
});
|
||||
|
||||
Bangle.on('tap', _e => {
|
||||
if(exs.state.active) return;
|
||||
|
||||
const menu: Menu = {
|
||||
"": {
|
||||
remove: () => {
|
||||
draw();
|
||||
},
|
||||
},
|
||||
"< Back": () => {
|
||||
Bangle.setUI(); // calls `remove`, which handles redrawing
|
||||
},
|
||||
"Zero time": () => {
|
||||
exs.start(); // calls reset
|
||||
exs.stop(); // re-pauses
|
||||
Bangle.setUI();
|
||||
},
|
||||
"Clear splits": () => {
|
||||
splits.splice(0, splits.length);
|
||||
Bangle.setUI();
|
||||
},
|
||||
};
|
||||
|
||||
E.showMenu(menu);
|
||||
});
|
||||
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "pace",
|
||||
"name": "Pace",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Show pace and time running splits",
|
||||
"icon": "app.png",
|
||||
"tags": "run,running,fitness,outdoors",
|
||||
|
|
|
|||
Loading…
Reference in New Issue