added motion detection
This commit is contained in:
parent
60415dc4ae
commit
3e174365b0
@ -11,7 +11,7 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
const CACHE_VERSION = { 'version': '0.0.963' };
|
const CACHE_VERSION = { 'version': '0.0.966' };
|
||||||
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
||||||
const RUNTIME = 'runtime';
|
const RUNTIME = 'runtime';
|
||||||
|
|
||||||
|
@ -110,11 +110,15 @@ const LocationModel = Backbone.Model.extend({
|
|||||||
console.log('Cur', motion.cur);
|
console.log('Cur', motion.cur);
|
||||||
|
|
||||||
const timeS = (motion.cur.ts - motion.prev.ts) / 1000.0;
|
const timeS = (motion.cur.ts - motion.prev.ts) / 1000.0;
|
||||||
|
|
||||||
|
console.log('time dif', timeS);
|
||||||
|
|
||||||
const speedMps = dist / timeS;
|
const speedMps = dist / timeS;
|
||||||
const speedKph = (speedMps * 3600.0) / 1000.0;
|
const speedKph = (speedMps * 3600.0) / 1000.0;
|
||||||
motion.cur.speed = speedKph;
|
|
||||||
motion.speed = speedKph;
|
motion.cur.speed = Number.parseFloat(speedKph).toFixed(3);
|
||||||
motion.distance = dist;
|
motion.speed = Number.parseFloat(speedKph).toFixed(3);
|
||||||
|
motion.distance = Number.parseFloat(dist).toFixed(3);
|
||||||
console.log(motion);
|
console.log(motion);
|
||||||
this.set('motion', motion);
|
this.set('motion', motion);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user