1.
field created by "build for device wizard"
function compute(info) {
if(info has :elapsedDistance ) {
if(info.elapsedDistance != 0 && info.elapsedDistance != null && mElapsedDistance != info.elapsedDistance) {
mElapsedDistance = info.elapsedDistance;
// Handling lap counter.
mLapNumber++;
}
}
}
function onUpdate(dc)
{
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_WHITE);
dc.clear();
//!Handling data.
var lapString;
// Construct the lap string.
var mElapsedDistanceString = mElapsedDistance.format("%d") + "";
mDataX = dc.getWidth() / 2;
mDataY = dc.getHeight() / 2 + mDataYAdjust;
// Draw the lap number
dc.drawText(mDataX, mDataY, mDataFont, mElapsedDistanceString, (Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER));
//! Handling Lable.
// Center the field label
mLabelX = dc.getWidth()/2;
// Draw the field label.
dc.drawText(mLabelX, mLabelY, mLabelFont, mLabelString, Gfx.TEXT_JUSTIFY_CENTER);
}
2.
field created by "export wizard" and downloaded from the app store
function compute(info) {
if(info.elapsedDistance != 0 && info.elapsedDistance != null && mElapsedDistance != info.elapsedDistance) {
mElapsedDistance = info.elapsedDistance;
// Handling lap counter.
mLapNumber++;
if(mLapNumber % mLapNumberNotify == mLapNumberNotify - 1)
{
vibeData =
[
new Attention.VibeProfile(50, 2000), // On for a second
new Attention.VibeProfile(0, 1000), // Off for a second
new Attention.VibeProfile(50, 2000),
new Attention.VibeProfile(0, 1000),
];
Attention.vibrate(vibeData);
}
}
}
}
function onUpdate(dc)
{
// Timer events are supported so update the view with the
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_WHITE);
dc.clear();
//!Handling data.
var lapString;
// Construct the lap string.
lapString = mLapNumber.format("%d") + "";
mDataX = dc.getWidth() / 2;
mDataY = dc.getHeight() / 2 + mDataYAdjust;
// Draw the lap number
dc.drawText(mDataX, mDataY, mDataFont, lapString, (Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER));
//! Handling Lable.
// Center the field label
mLabelX = dc.getWidth()/2;
// Draw the field label.
dc.drawText(mLabelX, mLabelY, mLabelFont, mLabelString, Gfx.TEXT_JUSTIFY_CENTER);
}
Both fields are used
after 20th lap (25m each lap):
1st field shows 500
2nd field shows 19
can anyone help me figure out whats going on?
thanks Avner