I have a couple of issues:
1. When I run simulation, my activity info elapsedDistance value does not change. If I try with a .fit file, it is the same. It is either 0 or a fixed value.
Is it a simulator issue, or elapsedDistance is not reliable?
2. I know this is basic, but I have a calculation function that gives me a distance between two GPS coordinates. i could use it with the activity position, but I cannot figure out how to pass values to another function.
function compute(info) {
startLat = info.startLocation.toDegrees()[0].toString();
startLon = info.startLocation.toDegrees()[1].toString();
if(info has :currentLocation){
if(info.currentLocation != null){
lat = info.currentLocation.toDegrees()[0].toString();
lon = info.currentLocation.toDegrees()[1].toString();
}
}
speedGps = info.currentSpeed;
Sys.println("Distance = "+info.elapsedDistance);'
calculateDistance(startLat, startLon, lat, lon);
// get the distance back here.
}
function calculateDistance(startLat, startLon, lat, lon) {
// USE my function and variables here to calculate distance
// How do i send the distance value back?
}
3. I cannot figure out if there is a way to calculate distance using accelerometer data. Do I need to calculate it between points? Can I use the accelerometer in a data field?
Thanks for the help