Altitude in a watch face

Hi
When you use Act.getActivityInfo().altitude in a watch face

What is the result for a watch who don't have barometer ?

it must create a filter for watches without barameter

Than'ks
  • In a watchface when you get the data from Activity.info for this, it is the last value from the last time you recorded an activity, so it's GPS or Baro Alt based. It can go stale over time and is not real time.

    On some watches, SenorHistory is available, and specifically getElevationHistory() which will give you the last elevation reading (they occur every few minutes). I use the 4 different getXYZHistory() calls in SH for this watchface, for example:

    https://apps.garmin.com/en-US/apps/343833f2-10ef-4d96-bee7-d668b708055e
  • Former Member
    Former Member over 8 years ago
    getElevationHistory and Duration

    Hey Jim,

    I am trying to get getElevationHistory to work and am currently nearly getting crazy.

    When I do this:

    [FONT=Courier New]var d = new Toybox.Time.Duration(4*3600);
    Sys.println((d instanceof Toybox.Time.Duration).toString());
    var elh = Toybox.SensorHistory.getElevationHistory({:period => d, :order => Toybox.SensorHistory.ORDER_NEWEST_FIRST}); [/FONT]

    ...it works fine in the emulator but on the vivoactive HR running 2.90 with CIQ 2.1.1 it throws an Exception of UnexpectedTypeException: Expected an object of type Time.Duration

    So I am wondering what am I doing differently from you. Obviously you do not face this issues with your watch face.
  • try commenting out the Sys.println(). I'm not what sure what trying to do there.


    What is it you are trying to do?
  • He's trying to get elevation history for the last 4 hours and it fails with an exception. The Sys.println() is to verify that d is indeed a Time.Duration as it should be.

    Travis
  • I've found the best way to use getElevationHistory is just use defaults:

    ret=SH.getElevationHistory({}); The first sample is the newest. on the va-hr, you get 148 samples (the max available - the "4 hours" - the same width of the screen in pixels)

    Are you getting the error on the println or on the getElevationHistory() call? I was thinking you got it on the println().

    You may also take out order and try that if your getting the error on the getElevationHistory() call. I reported a number of odd things with getABCHistory() (all 4 of them) in SensorHistory having to do with period and order and found it was safest to let things default. I've never gone back to see if the things are fixed, as I'm just working with the defaults.
  • Oh, another note on SensorHistory. It's not available on 1.3.x devices (the doc is a bit vague), and in testing, getHeartRateHistory, only on devices with devices with a WHRM, and the only device I've found that supports the other 3 is the va-hr, so if you use getElectionHistory(), that will only work on the va-hr.
  • Former Member
    Former Member over 8 years ago
    Leaving out the parameters

    I've found the best way to use getElevationHistory is just use defaults:

    ret=SH.getElevationHistory({});


    That did the job. Thanks for your help!
    Tried every variation of parameters but hadn't tried to skip them completly.