From af7091e0cc5cc4c218abcb40b565c7032c60c4a4 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Sun, 4 Nov 2018 12:43:57 +0000 Subject: [PATCH] added motion detection --- src/service-worker.js | 2 +- src/v1/js/Location.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service-worker.js b/src/service-worker.js index 9ba8f7e..6684887 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -const CACHE_VERSION = { 'version': '0.0.960' }; +const CACHE_VERSION = { 'version': '0.0.961' }; const PRECACHE = `jubileeData-${CACHE_VERSION.version}`; const RUNTIME = 'runtime'; diff --git a/src/v1/js/Location.js b/src/v1/js/Location.js index 2d6231f..2e50171 100644 --- a/src/v1/js/Location.js +++ b/src/v1/js/Location.js @@ -105,14 +105,14 @@ const LocationModel = Backbone.Model.extend({ motion.cur.lon = longitude; motion.cur.ts = ts; - const distance = distance(motion.prev.lat, motion.prev.lon, latitude, longitude); + const dist = distance(motion.prev.lat, motion.prev.lon, latitude, longitude); const timeS = (motion.cur.ts - motion.prev.ts) / 1000.0; - const speedMps = distance / timeS; + const speedMps = dist / timeS; const speedKph = (speedMps * 3600.0) / 1000.0; motion.cur.speed = speedKph; motion.speed = speedKph; - motion.distance = distance; + motion.distance = dist; console.log(motion); this.set('motion', motion); }