pace: fix pace calculation

master
Rob Pilling 2024-10-14 18:38:06 +01:00
parent a19d56c860
commit 281b178613
1 changed files with 3 additions and 5 deletions

View File

@ -64,11 +64,6 @@ const layout = new Layout({
lazy: true lazy: true
}); });
const calculatePace = (split: Split) => {
if (split.dist === 0) return 0;
return split.time / split.dist / 1000 / 60;
};
const draw = () => { const draw = () => {
if (!exs.state.active) { if (!exs.state.active) {
// no draw-timeout here, only on user interaction // no draw-timeout here, only on user interaction
@ -104,6 +99,9 @@ const formatDuration = (ms: number) => {
return `${pad2(tm.m)}:${pad2(tm.s)}`; return `${pad2(tm.m)}:${pad2(tm.s)}`;
}; };
// divide by actual distance, scale to milliseconds
const calculatePace = (split: Split) => formatDuration(split.time / split.dist * 1000);
const drawSplits = () => { const drawSplits = () => {
g.clearRect(Bangle.appRect); g.clearRect(Bangle.appRect);