Tweaks

Fundamentally the problem is the same one as in this thread:

The variable names for altitude, speed and vertical rate have changed in 3.6.2

2 Likes

Thanks all for the comment
so itā€™s clear from you comment that field names were changed.

LawrenceHill,
can you explain please : ā€œamend procedureā€ in the mentioned thread : do I have to insert the code or replace some code, this is not clear to me

Thanks

Sorry, I was not trying to say that you should insert or replace code with that in the other thread.
I was just trying to give a starting point for the sort of modification that would be needed.
If you are using dump1090-mutability but want to use the java script from the latest dump1090-fa you will need to modify the updateData procedure in planeObject.js to allow it to use the variable names used in dump1090-mutability.
Unfortunately, I am not familiar with mutability so cannot tell you the exact mods that are needed but it seems that @abcd567 is. Hopefully the information may point him in the correct direction.

2 Likes

The quoted thread relates to a non-standard set of files (GitHub - alkissack/Dump1090-OpenLayers-html: Modifications to the Openlayers html files (part of the dump1090-fa branch)). If you are on standard code, the changes are probably in the same file (planeObject.js) and same procedure (updateData)ā€¦

If your looks like:

    if (typeof data.altitude !== "undefined")
	    this.altitude	= data.altitude;
    if (typeof data.vert_rate !== "undefined")
	    this.vert_rate	= data.vert_rate;
    if (typeof data.speed !== "undefined")
	    this.speed	= data.speed;

then change it to be:

        if (typeof data.alt_baro !== "undefined")
		   this.altitude	= data.alt_baro;
        if (typeof data.geom_rate !== "undefined")
		   this.vert_rate	= data.geom_rate;
        if (typeof data.gs !== "undefined")
		   this.speed	= data.gs;
2 Likes

@Patrius
@LawrenceHill

FOR INFORMATION ONLY

This is CURRENT - Missing Altitude & Speed (after replacing original html folder of dump1090-mutability by html folder of dump1090-fa)

Relevant part (updateData procedure) of planeObject.js in dump1090-fa ver 3.6.2

// Update our data
PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
        // Update all of our data
        this.messages   = data.messages;
        this.rssi       = data.rssi;
        this.last_message_time = receiver_timestamp - data.seen;

        // simple fields

        var fields = ["alt_baro", "alt_geom", "gs", "ias", "tas", "track",
                      "track_rate", "mag_heading", "true_heading", "mach",
                      "roll", "nav_altitude", "nav_heading", "nav_modes",
                      "nav_qnh", "baro_rate", "geom_rate",
                      "squawk", "category", "version"];

        for (var i = 0; i < fields.length; ++i) {
                if (fields[i] in data) {
                        this[fields[i]] = data[fields[i]];
                } else {
                        this[fields[i]] = null;
                }
        }

        // fields with more complex behaviour

        if ('type' in data)
                this.addrtype   = data.type;
        else
                this.addrtype   = 'adsb_icao';

        // don't expire callsigns
        if ('flight' in data)
                this.flight     = data.flight;

        if ('lat' in data && 'lon' in data) {
                this.position   = [data.lon, data.lat];
                this.last_position_time = receiver_timestamp - data.seen_pos;

                if (SitePosition !== null) {
                        var WGS84 = new ol.Sphere(6378137);
                        this.sitedist = WGS84.haversineDistance(SitePosition, this.position);
                }

                this.position_from_mlat = false;
                if (typeof data.mlat !== "undefined") {
                        for (var i = 0; i < data.mlat.length; ++i) {
                                if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
                                        this.position_from_mlat = true;
                                        break;
                                }
                        }
                }
        }

        // Pick an altitude
        if ('alt_baro' in data) {
                this.altitude = data.alt_baro;
        } else if ('alt_geom' in data) {
                this.altitude = data.alt_geom;
        } else {
                this.altitude = null;
        }

        // Pick vertical rate from either baro or geom rate
        // geometric rate is generally more reliable (smoothed etc)
        if ('geom_rate' in data) {
                this.vert_rate = data.geom_rate;
        } else if ('baro_rate' in data) {
                this.vert_rate = data.baro_rate;
        } else {
                this.vert_rate = null;
        }

        // Pick a speed
        if ('gs' in data) {
                this.speed = data.gs;
        } else if ('tas' in data) {
                this.speed = data.tas;
        } else if ('ias' in data) {
                this.speed = data.ias;
        } else {
                this.speed = null;
        }
};

.
.

This was ORIGINAL, showed Altitude and Speed as well (before replacing html folder) ā€¦ NO MORE IN USE

Relevant part (updateData procedure) of planeObject.js in dump1090-mutability ver 1.14

// Update our data
PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
        // Update all of our data
        this.messages   = data.messages;
        this.rssi       = data.rssi;
        this.last_message_time = receiver_timestamp - data.seen;

        if (typeof data.altitude !== "undefined")
                this.altitude   = data.altitude;
        if (typeof data.vert_rate !== "undefined")
                this.vert_rate  = data.vert_rate;
        if (typeof data.speed !== "undefined")
                this.speed      = data.speed;
        if (typeof data.track !== "undefined")
                this.track      = data.track;
        if (typeof data.lat !== "undefined") {
                this.position   = new google.maps.LatLng(data.lat, data.lon);
                this.last_position_time = receiver_timestamp - data.seen_pos;

                if (SitePosition !== null) {
                        this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
                }
        }
        if (typeof data.flight !== "undefined")
                this.flight     = data.flight;
        if (typeof data.squawk !== "undefined")
                this.squawk     = data.squawk;
};


.

1 Like

My planeObject.js looks like :

This is CURRENT - Missing Altitude & Speed (after replacing original html folder of dump1090-mutability by html folder of dump1090-fa)

Relevant part (updateData procedure) of planeObject.js in dump1090-fa ver 3.6.2`

I will try look into this part, but I infact Iā€™m not a javascript specialist at all

OK, found hack
Altitude works, Speed still not
.

.

(1) Opened file planeObject.js for editing

sudo nano /usr/share/dump1090-mutability/html/planeObject.js

.

(2) Pressed (Ctrl+w) keys, typed Pick a speed
Added

        }  else if ('altitude' in data) {
                this.altitude = data.altitude;

just above

        } else {
                this.altitude = null;
        }

.

The modified code becomes

        // Pick an altitude
        if ('alt_baro' in data) {
                this.altitude = data.alt_baro;
        } else if ('alt_geom' in data) {
                this.altitude = data.alt_geom;
        }  else if ('altitude' in data) {
                this.altitude = data.altitude;
        } else {
                this.altitude = null;
        }

.

(3) Pressed (Ctrl+w) keys, typed Pick a speed
Added

        } else if ('speed' in data) {
                this.speed = data.speed;

just above

        } else {
                this.speed = null;
        }

.

The modified code becomes

        // Pick a speed
        if ('gs' in data) {
                this.speed = data.gs;
        } else if ('tas' in data) {
                this.speed = data.tas;
        } else if ('ias' in data) {
                this.speed = data.ias;
        } else if ('speed' in data) {
                this.speed = data.speed;
        } else {
                this.speed = null;
        }

I have done following in the code based upon the information in the other replies :
regarding altitude : replaced ā€œnullā€ with ā€œdata.altitudeā€
regarding vert rate : replaced ā€œnullā€ with ā€œdata.vert_rateā€
regarding speed ;more tweaking by putting :

else if ('speed' in data) {
               this.speed = data.speed;

see complete change hereunder :

   
        //  Pick an altitude
        if ('alt_baro' in data) {
                this.altitude = data.alt_baro;
        } else if ('alt_geom' in data) {
                this.altitude = data.alt_geom;
        } else {
                this.altitude = data.altitude;
        }

        // Pick vertical rate from either baro or geom rate
        // geometric rate is generally more reliable (smoothed etc)
        if ('geom_rate' in data) {
                this.vert_rate = data.geom_rate;
        } else if ('baro_rate' in data) {
                this.vert_rate = data.baro_rate;
        } else {
                this.vert_rate = data.vert_rate;
        }

        Pick a speed
         if ('gs' in data) {
                this.speed = data.gs;
        } else if ('tas' in data) {
                this.speed = data.tas;
        } else if ('ias' in data) {
                this.speed = data.ias;
        } else if ('speed' in data) {
               this.speed = data.speed;
        }

the result is better but not complete : still missing the speed
see screenshot
any further suggestions or remarks that this can be better or should not be done ?

image

Thanks

1 Like

I think our replies crossed :slight_smile:

1 Like

:slight_smile:
Both of us independently found the same solution.
I have noticed you typing a reply while I was typing mine.

Good work.
:+1: :+1: :+1:

@Patrius
Could you solve the Speed issue?
I am trying, but still no solution.
I dont understand why the hack which worked OK for Altitude, fails for Speed :thinking:

@abcd567
No solution found for the speed.
I also donā€™t understand why. :roll_eyes:

@wiedehopf
@LawrenceHill
@Akissack
@Patrius

Ok, solved it in an easy way: used html folder from source code of ver 3.5.3

.

STEP-BY-STEP METHOD:

(1) Rename original folder html to original-html.
This will preserve original folder and enable you to revert in case something goes wrong.

sudo mv /usr/share/dump1090-mutability/html  /usr/share/dump1090-mutability/original-html  
 

.

(2) Clone dump1090 ver 3.5.3

cd ~/ 

git clone https://github.com/flightaware/dump1090.git 

cd ~/dump1090 

git fetch --all 

git reset --hard  232a64e 
HEAD is now at 232a64e Prepare for 3.5.3 release

.

(3) Copy folder public_html to folder dump1090-mutability folder, renaming copy html

sudo cp -r ~/dump1090/public_html  /usr/share/dump1090-mutability/html 

.

(4) Rename file index.html to gmap.html

sudo mv /usr/share/dump1090-mutability/html/index.html  /usr/share/dump1090-mutability/html/gmap.html 

(5) Clear browser cache (Ctrl+Shift+Delete), and reload (Ctrl+F5)

ENJOY!!!

EXTRA Steps for those who have tried this tweak using ver 3.6.2

(a) Delete ver 3.6.2 folders dump1090 and html
(b) Do not perform step (1) above as you have already done it.

sudo rm -rf ~/dump1090

sudo rm -rf /usr/share/dump1090-mutability/html
1 Like

@abcd567
:+1:
up and running
Thanks for this solution

Customizing Time and Date Display in SkyView

Forum member @evangelyul has posted this very useful tweak here:

1 Like

Hi,
the RPi I have is configured with a standard image and then implement the software/hardware I like
So regarding testing the influence of the gain I take scenario ā€œOptimize-Gain-dump-fa-on-Raspbian-Jessieā€

My system is stretch I think:
Linux 4.14.62-v7+ #1134 SMP Tue Aug 14 17:10:10 BST 2018 armv7l

When I look into the script (I donā€™t know python, just guessing here), it looks for the config file : /etc/default/dump1090-fa, which I have and changes the line ā€œRECEIVER_OPTIONSā€ with different gain values to do the tests,

However the line in the script differs from my first line in the config file , so I presume itā€™s ok to change the script and take the parameters from my config file to do the test ?
(I see that some parameters in the script are defined in the ā€œNET_OPTIONSā€ line.

line in the script :

      if line.startswith('RECEIVER_OPTIONS'):
         print 'RECEIVER_OPTIONS="--device-index 0  --ppm 0 --gain  ' + g + ' --net-bo-port 30005 --net-sbs-port 30003"'

lines in my /etc/default/dump1090-fa :

RECEIVER_OPTIONS="--device-index 0 --gain -10 --ppm 0 --net-bo-port 30005"
DECODER_OPTIONS="--max-range 360"
NET_OPTIONS="--net --net-heartbeat 60 --net-ro-size 1000 --net-ro-interval 1 --net-ri-port 0 --net-ro-port 30002 --net-sbs-port 30003 --net-bi-port 30004,30104 --net-bo-port 30005"
JSON_OPTIONS="--json-location-accuracy 1"

Is this ok to go forward ?
Thanks for any suggestions

Yes, thatā€™s where you change the gain. Note that ā€œg -10ā€ is just a made-up value that is translated into Automatic Gain Control (analog side).
Supported gain values (29) are usually: 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6

If you put another value, it will be rounded to the closest one.
Also you can try adding --enable-agc to enable digital AGC (not tuner AGC!). Personally I didnā€™t like it.

After any change do sudo systemctl restart dump1090-fa to implement.
You can also check the current value by sudo systemctl status dump1090-fa -l

Dont use it. Use:

(2) Optimize Gain Script for: dump1090-fa on Raspbian

From this post:

https://discussions.flightaware.com/t/tweaks/20339/38

Ok I will , but they are the same (did a comparison in notepad++)
what about the suggestion that I take following parameter out :

--net-sbs-port 30003

its defined in the ā€œNET_OPTIONSā€ line