jesmak / MMM-FlightRadarTracker

MagicMirror module that tracks nearby planes based on Flightradar24 data
MIT License
20 stars 3 forks source link

Distance and Height #12

Closed length967 closed 9 months ago

length967 commented 1 year ago

altitudeUnits controls both the distance from me and the height. I'd like to see the height in feet but in this case the distance would also be a large number in ft (often around 100,000ft). Can these 2 be set independently to show the distance from me in KM/Miles and height in FT?

iotricity commented 1 year ago

Open the MMM-FlightRadarTracker.js file. In the config section, add after line 10:

distanceUnits: 'metric',

In what becomes line 113/114, change the altitudeUnits to distanceUnits:

const distance = aircraft.distance * (this.config.distanceUnits === 'metric' ? 1 : 3.28084);
if (this.config.distanceUnit === 'metric' && distance >= 10000) {

And in line 118, also change the altitudeUnits to distanceUnits:

subHeading.push(`<span><i class="fas fa-location-arrow dimmed"></i>${Math.floor(distance)}<sup>${this.config.distanceUnits === 'metric' ? 'm' : 'ft'}</sup></span>`);

-update- I've added a pull request #13 for this.