Altitude data on EDGE Datafield

Former Member
Former Member

Hi,

I am trying to develop a datfield for EDGE device.... The idea is to show the altitude data but when I displayed on simulation it's showing wrong number. I check simulation setting "GPS position" but the new position is showing bad number.

Attached my code to display this number.

// ALTITUDE metric ++++ The altitude above mean sea level in meters (m) // Toybox.Lang.Float
        if( info has :altitude ) {
            if( info.altitude != null ) {
            var deviceSettings = System.getDeviceSettings();
            if ( deviceSettings.elevationUnits == 0 )
                { vAltitude = Position.getInfo().altitude.abs(); if ( vInitialAltitude == 0 ) { vInitialAltitude = vAltitude; } } // UNIT_METRIC = 0
            else { vAltitude = (Position.getInfo().altitude.abs() ) * 3.28; if ( vInitialAltitude == 0 ) { vInitialAltitude = vAltitude; } } // UNIT_STATE = 0
            } else { vAltitude = 0.0f; }}

Sys.println("Value vAltitude : " + vAltitude);   

What is wrong on this code?

Is there another way to get this number?

Thanks in advance,