I'm new to this, I'm fighting my way through a small data field experiment and I'm perplexed at my inability to display either info.energyExpenditure or calories. I can simulate the data but when I play a fit file I get nothing. I can playback several other fields with no issue. I'm trying to build for an Edge 520. The code is pretty darn straightforward. What am I missing? I appreciate any insight.
import Toybox.Activity;
import Toybox.Lang;
import Toybox.Time;
import Toybox.WatchUi;
class EnExpView extends WatchUi.SimpleDataField {
// Set the label of the data field here.
function initialize() {
SimpleDataField.initialize();
label = "Energy Exp";
}
// The given info object contains all the current workout
// information. Calculate a value and return it in this method.
// Note that compute() and onUpdate() are asynchronous, and there is no
// guarantee that compute() will be called before onUpdate().
function compute(info as Activity.Info) as Numeric or Duration or String or Null {
// See Activity.Info in the documentation for available information.
var mEnergyExp as float = 0.0;
if (info has :energyExpenditure) {
mEnergyExp = (info.energyExpenditure).format("%.2f");
}
// if (info has :currentHeartRate && info.currentHeartRate != null) {
// mEnergyExp = (info.currentHeartRate).format("%.2f");
//
// }
return mEnergyExp;
}