Hi all, I have just started feeding ADSBExchange using the prebuilt image.I use a large external antenna on the roof, with the Flightaware Pro Plus Stick + an Extra 1090 band pass filter. There is a gain optimisation script for the FR24 dump1090 mutability build that restarts dump1090 with a different gain each time and reports the results. Obviously ADSBEx uses readsb instead of dump1090 (even though its basically a fork). I can't seem to make it work. I have been trying to modify the script by changing the dump1090 executable paths to the following. The script runs however when looking in HTOP for the readsb process, I can still see the GAIN value as specified in the adsb-config.txt in /boot. Can anyone help? Would be a great tool to optimise our set ups quickly! Code: #!/usr/bin/python2 import time, socket, subprocess, fileinput, os measure_duration = 62 #seconds ntests = 5 gains = "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".split() #gains = "36.4 38.6 40.2 42.1 44.5 48.0 49.6".split() #gains = "22.9 25.4 28.0 29.7 32.8 33.8 36.4".split() gains.reverse() results = {} for i in range(ntests): print "test", i+1, "of", ntests for g in gains: if g not in results: results[g] = [0,0,{}] #msgs, positions, aircraft for line in fileinput.input('/usr/bin/readsb', inplace=1): if line.startswith('GAIN'): print 'GAIN='+g else: print line, os.system("sudo systemctl restart readsb") time.sleep(2) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost',30003)) t = time.time() d = '' while 1: d += s.recv(32) if time.time() - t > measure_duration: break s.close() messages = 0 positions = 0 planes = {} for l in d.split('\n'): a = l.split(',') messages += 1 if len(a) > 4: if a[1] == '3': positions += 1 planes[a[4]] = 1 print "gain=",g, "messages=", messages, "positions=", positions, "planes=", len(planes.keys()) results[g][0] += messages results[g][1] += positions for hex in planes.keys(): results[g][2][hex] = 1 print "\n===Totals===" print "Gain, Messages, Positions, Aircraft" for g in gains: (messages,positions,planes) = results[g] print g, messages, positions, len(planes.keys())
Just ran the script. Picked the best value and changed value in adsb-config.txt in /boot. Value I set in adsb-config.txt in /boot is confirmed in HTOP. Since the image uses a custom location for the value my guess is the easiest way is to run the script and pick the best value and edit adsb-config.txt in /boot Don't forget to restart the pi or the service to pickup the new value.
You must have literally read my post completely wrong. I ended up installing a standard dump1090 mutability, running the script, killing dump1090-mutability and then set the gain in the boot config as you did. But as I said in my first post, the script does NOT work with readsb, even when changing the executable paths. The gain value the script tries to specificy is not taken and the script results are useless.
Sorry, Did not read the script that close, thought it was trying to set the gain itself. Found out why its not working but don't know how to fix it. When the script resets readsb it gets the gain from adsb-config.txt in /boot. I can change the gain in adsb-config.txt in /boot and start the script and that is the value shown on HTOP. If you can script to change the value in adsb-config.txt in /boot after every test it should work. Bill
Got it to work. Change line 18: for line in fileinput.input('/usr/bin/readsb', inplace=1): to: for line in fileinput.input('/boot/adsb-config.txt', inplace=1):