Display Temperature on Edge 1000 DataField

I'm working on a (complex) datafield for the Edge 1000 and one thing I'd like to display is the temperature from the internal sensor.

I've read conflicting things about whether this is even possible - ie that it can be done but you must create a background process that runs every five minutes or something... but all this information is a few years old so I'm not sure if anything has changed.

One issue I'm having with anything I try is that I get a pair of "Permission required" errors when I attempt to run the app in the simulator. I have enabled the permissions in the manifest (Background, Sensor History, and Sensor).

In the initialize function declaration I'm also enabling the sensors like so:

function initialize() {

DataField.initialize();

Sensor.setEnabledSensors([Sensor.SENSOR_TEMPERATURE]);

Sensor.enableSensorEvents(method(:onSensor));

mValue = 0.0f;

speed = 0.0f;

batteryPercent = 0;

temperature = 0;

}

What am I doing wrong here? Is there anything that can even be done to achieve what I'm looking for, or is it impossible to get the temperature in a custom data field on the Edge 1000?
  • What I am really trying to accomplish is that MyField1 and MyField2 have access to the same value, which MyField1 can manipulate (set), and MyField2 can retrieve (get). I was hoping to accomplish this with a barrel with a module-level variable in it. But since, as you confirm in your answer, a barrel is only code and not a compiled unit, this does not work.

    Would there be some other way to do what I want, that is, have one shared value that two separate data fields can access?
  • What I am really trying to accomplish is that MyField1 and MyField2 have access to the same value, which MyField1 can manipulate (set), and MyField2 can retrieve (get).


    There is no way that MyField1 can access MyField2's data or settings (or v/v). With barrels they can have common code to generate the same data, but each DF has to get the data itself.
    The only way to share is if one DF send the data to your phone or a website, and the other got it from there

  • Too bad. I was already afraid that this might be the case. Anyway, thanks for your answers.
  • Hi

    Is there any update regarding sensor readings in background processes ?

    Is it already possible to read temperature in a datafield more frequent than 5 minutes?

    regards

    Erich

  • Still every 5 minutes, and on an edge you need to do a background process, while on watches (with a baro altimeter), you can get the internal temp using SensorHistory.getTemperatureHistory(), that only gets updated every minute or two.  If a tempe is used, that value only changes every minute, but in a DF, you need to get that data in a background process, in the same way and edge gets it (Sensor info on an edge returns the internal temp vale, while on watches, it returns the tempe value - you can't pair a tempe with an Edge)

  • Quick Update to the situation. Garmin in some fresh firmwares disabled on Edge Explore the temperature sensor readings. It worked before normally and suddenly stopped.

    They answered me:

    I apologize for not responding sooner.  Our device team said that there is no default temperature sensor in the Edge Explore and the temperature option was accidentally enabled.  So it was correctly removed in the latest firmware.

    Ok. But if you disable temperature for Explore, you disable it for Edge 1000 too!

    Build Target does not separate these two devices.