pace: generate JS

master
Rob Pilling 2024-12-03 12:15:32 +00:00
parent 1c4eaed61c
commit c2f9f3e9b1
1 changed files with 30 additions and 4 deletions

View File

@ -140,10 +140,12 @@
var totalDist = dist.getValue();
var thisSplit = totalDist - prev.dist;
var thisTime = exs_1.state.duration - prev.time;
while (thisSplit > 1000) {
if (thisSplit > 1000) {
if (thisTime > 0) {
if (splits_1.length || thisTime > 1000 * 60)
splits_1.push({ dist: thisSplit, time: thisTime });
thisTime = 0;
thisSplit -= 1000;
}
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);