flyingrub / SpeedMeter

Display the gps speed [Android]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getAverageSpeed and getAverageSpeedMotion might return NaN if time or motionTime is smaller than 1000.

tvasiliou opened this issue · comments

getAverageSpeed and getAverageSpeedMotion might return NaN if time or motionTime is smaller than 1000.

The step (time / 1000) or (motionTime / 1000) will divide (long)/(int) producing long therefore long.
if time or motionTime is smaller than 1000 e.g. 6 the division should be 0.006 but since it is long the output will be 0.

The solution would be to change the step to (time / 1000.0) or (motionTime / 1000.0)