fix speed calcs
parent
ae42515fc1
commit
c4c539006a
|
|
@ -110,7 +110,7 @@ Bangle.on("GPS", function(fix) {
|
||||||
if (stats["dist"]) stats["dist"].emit("changed",stats["dist"]);
|
if (stats["dist"]) stats["dist"].emit("changed",stats["dist"]);
|
||||||
var duration = Date.now() - state.startTime; // in ms
|
var duration = Date.now() - state.startTime; // in ms
|
||||||
state.avrSpeed = state.distance * 1000 / duration; // meters/sec
|
state.avrSpeed = state.distance * 1000 / duration; // meters/sec
|
||||||
state.curSpeed = state.curSpeed*0.8 + fix.speed*0.2*3.6; // meters/sec
|
state.curSpeed = state.curSpeed*0.8 + fix.speed*0.2/3.6; // meters/sec
|
||||||
if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
|
if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
|
||||||
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
|
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
|
||||||
if (stats["speed"]) stats["speed"].emit("changed",stats["speed"]);
|
if (stats["speed"]) stats["speed"].emit("changed",stats["speed"]);
|
||||||
|
|
@ -202,8 +202,8 @@ exports.getStats = function(statIDs, options) {
|
||||||
needGPS = true;
|
needGPS = true;
|
||||||
stats["speed"]={
|
stats["speed"]={
|
||||||
title : "Speed",
|
title : "Speed",
|
||||||
getValue : function() { return state.curSpeed/3.6; }, // in kph
|
getValue : function() { return state.curSpeed*3.6; }, // in kph
|
||||||
getString : function() { return require("locale").speed(state.curSpeed/3.6); },
|
getString : function() { return require("locale").speed(state.curSpeed*3.6); },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (statIDs.includes("caden")) {
|
if (statIDs.includes("caden")) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue