For Raspbian Jessie/Stretch + dump1090-fa package install
Only Step-1 is different for Jessie and Stretch, rest is same.
STEP-1 (JESSIE): Install necessary php packages and enable module
sudo apt-get update
sudo apt-get install php5-cgi
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/lighttpd force-reload
STEP-1 (STRETCH): Install necessary php packages and enable module
sudo apt-get update
sudo apt-get install php7.0-cgi
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/lighttpd force-reload
.
STEP-2: Set up existing user www-data
2.1 - Assign strong password to existing user www-data, and add it to sudoer’s group
sudo passwd www-data
sudo adduser www-data sudo
groups www-data
.
2.2 - REBOOT to enable permissions for www-data
sudo reboot
.
STEP-3: Create new directory and files
3.1 - Create new directory
sudo mkdir /var/www/html/setgain
.
3.2 - Move inside the new directory
cd /var/www/html/setgain/
.
3.3 - Inside directory /var/www/html/setgain, create a new blank file setgain.sh, make it executable
sudo touch setgain.sh
sudo chmod +x setgain.sh
.
3.4 - Open newly created file in nano editor
sudo nano setgain.sh
.
3.5 - Add code to the new file
(In code below, replace xxxxxxxxx by the actual password you have set for user www-data)
NOTE: Some of code lines are very long. Scroll Right to see these in full
.
#!/bin/bash
echo 'xxxxxxxxxx' | sudo -S sed -i '/RECEIVER_OPTIONS=.*/c\RECEIVER_OPTIONS="--device-index 0 --gain '$1' --ppm 0 --net-bo-port 30005"' /etc/default/dump1090-fa
echo 'xxxxxxxxxx' | sudo -S systemctl restart dump1090-fa
Save (Ctrl+o) and Close (Ctrl+x) the file.
.
3.6 - Inside directory /var/www/html/setgain, create a new blank file findgain.sh, make it executable
sudo touch findgain.sh
sudo chmod +x findgain.sh
.
3.7 - Open newly created file in nano editor
sudo nano findgain.sh
.
3.8 - Add code to the new file
(In code below, replace xxxxxxxxx by the actual password you have set for user www-data)
NOTE: Some of code lines are very long. Scroll Right to see these in full
.
#!/bin/bash
echo 'xxxxxxxxxx' | sudo -S awk '{for(i=1;i<=NF;i++) if ($i=="--gain") print $(i+1)}' /etc/default/dump1090-fa
Save (Ctrl+o) and Close (Ctrl+x) the file.
.
STEP-4
4.1 - Create a new file gain.php
in folder /usr/share/dump1090-fa/html
cd /usr/share/dump1090-fa/html/
sudo nano gain.php
4.2 - Copy-paste following code in newly created blank file gain.php
NOTE: Some of code lines are very long. Scroll Right to see these in full
.
<html>
<form id="myform" action="gain.php" method="post" />
<input type="text" name="gain" id="gain" maxlength="5" size="4" value="<?php system('/var/www/html/setgain/findgain.sh');?>" />
<input type="submit" value="Set Gain" style="color:#ffffff;background-color:#00A0E2;border-color:#00B0F0;" />
</form>
</html>
<?php
function setgain(){
$gain="{$_POST['gain']}";
system("/var/www/html/setgain/setgain.sh $gain >> /tmp/gain.log 2>&1");
header("Refresh:0");
}
if ("{$_POST['gain']}"){
setgain();
}
?>
.
Save (Ctrl+o) and Close (Ctrl+x)
.
STEP-5
5.1 - Next step is to edit file index.html
in folder /usr/share/dump1090-fa/html
.
BEFORE EDITING, make its backup copy. This will enable you to revert in case something goes wrong.
cd /usr/share/dump1090-fa/html/
sudo cp index.html index.bak.html
#Check to ensure back-up copy has been created by giving ls command
ls
#The output should contain both index.html and index.bak.html
config.js formatter.js layers.js script.js
db images markers.js spinny.gif
dbloader.js index.bak.html ol style.css
flags.js index.html planeObject.js test
flags-tiny jquery registrations.js upintheair.json
.
5.2 - Open the file index.html
for editing
cd /usr/share/dump1090-fa/html/
sudo nano index.html
5.3 - Press Ctrl+w then type buttonContainer
then press Enter key.
The cursor will jump to line containg word buttonContainer
, as shown below
<div class="logoContainer">
<a href="http://flightaware.com/" target="_blank"><img src="images/fa_logo_color.png" alt="FlightAware" class="flightawareLogo" srcset="images/fa_logo_color.png 1x, images/fa_logo_color@2x.png 2x, images/fa_logo_color@3x.png 3x"></a>
<img src="images/pa-sv-logo.png" alt="PiAware SkyView" class="adsbLogo piAwareLogo" srcset="images/pa-sv-logo.png 1x, images/pa-sv-logo@2x.png 2x, images/pa-sv-logo@3x.png 3x">
<img src="images/ff-sv-logo.png" alt="FlightFeeder SkyView" class="adsbLogo flightfeederLogo" srcset="images/ff-sv-logo.png 1x, images/ff-sv-logo@2x.png 2x, images/ff-sv-logo@3x.png 3x" style="display: none;">
</div>
<div class="buttonContainer">
<div class="dateTime" id="clock_div"></div>
<div class="button buttonHeader" onclick="resetMap();"><span class="buttonText">Reset Map</span></div>
.
5.4 - Just above line <div class="buttonContainer">
, insert following 3 lines
<div id="GAIN" style="text-align:center;width:175px;height:65px;">
<iframe src=gain.php style="border:0;width:175px;height:65px;"></iframe>
</div> <!----- GAIN --->
.
After insertion of 3 lines, the code will be like shown below:
<div class="logoContainer">
<a href="http://flightaware.com/" target="_blank"><img src="images/fa_logo_color.png" alt="FlightAware" class="flightawareLogo" srcset="images/fa_logo_color.png 1x, images/fa_logo_color@2x.png 2x, images/fa_logo_color@3x.png 3x"></a>
<img src="images/pa-sv-logo.png" alt="PiAware SkyView" class="adsbLogo piAwareLogo" srcset="images/pa-sv-logo.png 1x, images/pa-sv-logo@2x.png 2x, images/pa-sv-logo@3x.png 3x">
<img src="images/ff-sv-logo.png" alt="FlightFeeder SkyView" class="adsbLogo flightfeederLogo" srcset="images/ff-sv-logo.png 1x, images/ff-sv-logo@2x.png 2x, images/ff-sv-logo@3x.png 3x" style="display: none;">
</div>
<div id="GAIN" style="text-align:center;width:175px;height:65px;">
<iframe src=gain.php style="border:0;width:175px;height:65px;"></iframe>
</div> <!----- GAIN --->
<div class="buttonContainer">
<div class="dateTime" id="clock_div"></div>
<div class="button buttonHeader" onclick="resetMap();"><span class="buttonText">Reset Map</span></div>
.
Save (Ctrl+o) and Close (Ctrl+x)
.
5.5 - Go to page IP-of-PI/dump1090-fa/ and check gain setting add-on appears as shown in screenshot below.
The value show at browser load or re-load is your current gain value.
If you want to change it, replace the value displaced by value desired and click “Set Gain” button. The value in gain box will briefly show your previous setting, then show your current (changed) setting.
Check the gain value by following command. The last line of output of this command will show the actual value of gain used.
sudo systemctl status dump1090-fa -l
.