After ~20min the IQ datafield crashes

Former Member
Former Member
Hi,

I've tested my datafield a few times. But everytime about 20-30min after starting the workout the datafield crashes and only the IQ logo is shown.

Is it a bad code?

My: Sunsetrun15App.mc
usingToybox.Application asApp;
class Sunsetrun15App extends App.AppBase {

//! onStart() is called on application start up
function onStart() {
}

//! onStop() is called when your application is exiting
function onStop() {
}

//! Return the initial view of your application here
function getInitialView() {
return [ new Sunsetrun15View() ];
}

}


My: Sunsetrun15View.mc:
using Toybox.WatchUi as Ui;
using Toybox.Time as Time;

class Sunsetrun15View extends Ui.SimpleDataField {

var value = "--",
distance = 8700,
minElapsedDistance = 1;


//! Set the label of the data field here.
function initialize() {
label = Ui.loadResource(Rez.Strings.Label);
}


function compute(info) {


var rawValue,
hours,
minutes,
seconds,
estimatedSeconds;

if (info.elapsedDistance != null && info.elapsedDistance > minElapsedDistance && info.currentSpeed != null) {

var rawValue = (info.elapsedTime / 1000) + ((distance - info.elapsedDistance) / info.currentSpeed);
var options = { :seconds => rawValue };
value = Time.Gregorian.duration( options );
}

return value;
}
}


Maybe anybody can give me a hint?

Thx!