Commit graph

103 commits

Author SHA1 Message Date
Oliver Jowett 72bfc31458 Display message rate (30 sec average) on the webmap.
(cherry picked from commit 848af78be685c6e2a26d0b30e9f385696201a2c4)
2015-01-13 22:01:53 +00:00
Oliver Jowett fefce7b4bd Add --max-range parameter. Use it for relative position limits, and to discard bad position results.
(cherry picked from commit 0d725508f78cb2fd7759efbb66b45b867d6f7722)
2015-01-13 21:53:12 +00:00
Oliver Jowett 8d0d16c30a When sanity-checking relative CPR results, use the correct relative
location (which may not be the aircraft location).

I suspect this sanity check is, in fact, redundant now that the
rest of the algorithm has had some bugs fixed; it should only
produce results within half a cell by definition.
2015-01-12 16:29:24 +00:00
Oliver Jowett 583984af8a Use floor() not trunc() in relative CPR decoding.
The comment saying to use trunc() is wrong; the original algorithm
is correct.
2015-01-12 16:28:10 +00:00
Oliver Jowett bebc00c257 Fix quadrant selection for global CPR surface position decoding. 2015-01-12 16:26:05 +00:00
Oliver Jowett e1d2af42bb CPR relative decoding: avoid truncation when finding the fractional
position of the reference position within a lat/lng zone.
2015-01-12 16:16:32 +00:00
Oliver Jowett fa4c85eba5 Another bug found by valgrind. 2015-01-12 01:19:25 +00:00
Oliver Jowett 272efcbdc4 Fix thinko in skipping over decoded message samples. 2015-01-12 01:00:05 +00:00
Oliver Jowett f72fc3dbee Fix a couple of problems found by valgrind. 2015-01-12 00:56:51 +00:00
Oliver Jowett 48986c48cc Remove half-implemented --no-decode option. 2014-12-27 20:11:10 +00:00
Oliver Jowett 22f2a8db37 Merge branch 'net-cleanups' into oversampling
Conflicts:
	dump1090.c
	dump1090.h
2014-10-03 23:04:09 +01:00
Oliver Jowett 1769ac9006 Restructuring of network output side.
Mostly refactoring the common code that was duplicated
between the different output types so that there aren't
many copies floating around.

This introduces "struct net_writer" to store the state of a
particular type of output service - buffers, time of last write,
connection count etc. prepareWrite() / completeWrite() give access
to the buffer and handle the actual writes and flushing when needed.

Heartbeat and time-based flushing move into a generic periodic-work
function.

Update the SBS output code to use the new infrastructure. This makes
a big different to CPU use when under load.
2014-10-03 22:55:21 +01:00
MalcolmRobb dee6ded673 Merge pull request #35 from mutability/use-repaired-checksums
Check if bit correction happened before bailing out due to a bad CRC.
2014-10-02 21:29:10 +01:00
Malcolm Robb 4f449a8d44 Make Pull # compatible with Pull #42 2014-10-02 21:08:57 +01:00
MalcolmRobb 16a900c667 Merge pull request #42 from mutability/prefer-global-cpr
Prefer to use global CPR decoding where possible.
2014-10-02 21:05:26 +01:00
Oliver Jowett c11eca44bb Try all phases if --oversample --phase-enhance is on.
If we demodulate a message in 2.4MHz mode and it has a bad, uncorrectable CRC,
and --phase-enhance is on, then retry with the other possible phases until
we get a good CRC or run out of phases to try.

This is very expensive in AGC mode (lots of candidates that are not real
messages) but relatively cheap otherwise. It yields another 10% messages.

Also factor out some common stats code to avoid lots more copy/paste.
2014-09-30 17:02:22 +01:00
Oliver Jowett 93e1b9e10d More tweaking to try to get the signal / CPU tradeoff right. 2014-09-30 00:19:05 +01:00
Oliver Jowett dcae71faa8 Move CPU instrumentation up into the main loop. 2014-09-29 23:11:36 +01:00
Oliver Jowett 7a0ca85a90 Measure CPU used by the sample processing thread. 2014-09-29 23:04:58 +01:00
Oliver Jowett 4732ad3498 Performance tweaking for AGC.
Apparently enabling AGC produces samples with quite different characteristics,
and ends up eating a lot more CPU as the previous heuristics would generate a
lot of false positives. Tweaking the parameters and a bit of optimization
seems to bring this back down to usable levels without losing many potential
messages.
2014-09-29 23:02:42 +01:00
Oliver Jowett ca372ed105 Add SNR calculation in oversample mode. 2014-09-27 16:47:50 +01:00
Oliver Jowett e118668925 Log message time and symbol phase when dumping message info. 2014-09-27 16:45:39 +01:00
Oliver Jowett c3409302ce Fix mlat inter-block timestamp accounting in oversampling mode.
Add calculated phase into the per-message timestamp (it is already exactly a 12MHz offset)
2014-09-27 16:44:26 +01:00
Oliver Jowett 309f79c488 Tweak correlator weighings to be right, and scale up some more to avoid losing precision.
Further tweaking to which phase offsets we look for.
2014-09-27 13:35:41 +01:00
Oliver Jowett 69a30535d4 Oversampling, round two.
This now seems to be at the point where it will decode more messages
than when using 2MHz with --phase-enhance.
2014-09-27 13:07:23 +01:00
Oliver Jowett 17f73cc01a Fix preamble quiet-bits check. 2014-09-26 22:47:56 +01:00
Oliver Jowett 5c8e6198b7 First cut for sampling at 2.4MHz + phase detection. 2014-09-26 22:42:38 +01:00
Oliver Jowett 4cf07536be Merge branch 'report-snr' 2014-09-26 00:34:17 +01:00
Oliver Jowett 826d5e92fa Don't count ambiguous bits beyond bit 56 towards SNR. 2014-09-26 00:33:39 +01:00
Oliver Jowett fd4c480df7 Merge cleanup. 2014-09-25 17:18:44 +01:00
Oliver Jowett d820ae1afc Merge branch 'prefer-global-cpr' 2014-09-25 17:18:08 +01:00
Oliver Jowett 661246d347 Prefer to use global CPR decoding where possible.
There is a danger in always using relative decoding where possible.
If there is an undetected error in the first pair of messages received,
then global CPR decoding will give a bad position, and subsequent
relative decoding will just walk around near that bad position even
though many error-free pairs of odd/even messages may have been received.

The first pair of position messages also tends to be the most error-prone, as
they are usually received at the extreme edge of receiver range.

(I see this happen at least once a day in practice)

So, instead, prefer to use global decoding when we have sufficiently recent data.
With recent data this should always be as good as relative decoding, and it
avoids getting stuck with bad data for long periods of time. If we don't have
enough recent data for a global solution, fall back to relative decoding.
2014-09-25 17:10:55 +01:00
Oliver Jowett af281592e8 Merge branch 'discard-bad-cpr-latitudes' 2014-09-25 16:10:27 +01:00
Oliver Jowett e5b3572e8b Reject out-of-range latitudes when doing CPR decoding.
If a CPR message with an undetected error is received this can produce out-of-range results for latitude.
e.g. even latitude of 78000, odd latitude of 0 produces a latitude index j=35 and rlat0 = 213.
2014-09-25 15:49:39 +01:00
Oliver Jowett e6e92b1e8e Merge branch 'no-decode'
Conflicts:
	mode_s.c
2014-09-23 00:01:54 +01:00
Oliver Jowett 5683001164 Add --no-decode option.
This disables most decoding of the contents of Mode S messages, aircraft tracking, and some output modes that depend on them.
It's intended for edge receivers that just forward to a central hub rather than processing data locally.
2014-09-22 23:56:49 +01:00
Oliver Jowett 76c958b03e Use a lookup table for SNR calculation. 2014-09-22 14:53:06 +01:00
Oliver Jowett 2e45a59986 Make signalLevel represent the SNR in dB, rather than a somewhat arbitrary amplitude value.
Include SNR values when dumping message contents.
2014-09-15 02:49:11 +01:00
Oliver Jowett 0378620445 Merge branch 'improve-phase-enhancement' 2014-09-15 01:58:38 +01:00
Oliver Jowett 31b28b3878 Rearrange phase enhancement so that it handles phase errors in both directions.
This almost doubles the number of messages recovered by phase enhancement.
2014-09-15 01:43:14 +01:00
Oliver Jowett 7fab5b0cb5 Check if bit correction happened before bailing out due to a bad CRC. 2014-09-13 12:11:19 +01:00
Malcolm Robb 845289ad9f Version 1.09.1607.14
Improvements to COAA MLAT functions
Reduce CPU load in PPUP1090 and DUMP1090 during cleanup
2014-08-06 15:29:06 +01:00
Malcolm Robb 8b05286a24 Version 1.09.1007.14
Updates to support COAA Planeplotter Ground Station on an RPi
2014-08-06 15:29:05 +01:00
hhm d1b37ad1c5 B"H decoding: use last air position to calculate ground position 2014-07-14 04:03:07 -04:00
hhm 506be6e054 B"H decode more data, etc.
- decodes a bit more information
- misc. small changes
2014-06-22 13:05:39 -04:00
Markus Gräb 583f24299a Fixed: now skipping correct number of values in magnitude buffer
Variable j points to the current location in the magnitude vector.
When decoding a message  (MODES_PREAMBLE_US+msglen)*2 is added to j.
In the loop head j is increased by 1, so one value was skipped.
2014-05-14 19:39:07 +02:00
Malcolm Robb f7843c1691 Implement TCP Heartbeat
Some users have reported issues where the TCP link to dump1090 can be
lost at times of low traffic density - typically in the middle of the
night. One possible reason for this is that some routers drop the link
if there is no traffic for a predetermined period.

To try and resolve this, dump1090 now sends a 'null' packet consisting
of 7 "0x00" bytes approximately once a  minute if there is no real
received traffic during this time. This packet should be discarded by
the application receiving the dump1090 because it will have an invalid
checksum, and ICAO address 0x000000 is also invalid. However, this null
packet should be enough to keep routers alive.
2014-03-11 01:09:49 +00:00
Malcolm Robb 75a4c6ee21 BUGFIX : Missed data causes timestamp slip
The Mutex on the RTL data reader thread does not "force" the data
processing thread to execute. Therefore, if the processor is busy, it is
possible for a second RTL callback to occur before the data from the
first has been processed. This will cause the loss of the first data,
but worse, it will cause a slip in the timestamp. This upsets Beamfinder
and MLAT operation in PlanePlotter.

To solve this, keep a Fifo buffer which is filled by the callback
thread, and emptied by the data processing thread. The fifo is the same
size as the number of buffers requested in the call to
rtlsdr_read_async().

Note - we only put the value of the pointer supplied in the callback
into the fifo. We do not attempt to cache the data in the buffer pointed
to by the pointer.  This would require us to memcopy() 2Mbytes per
second, which we don't want to do if we don't have to because it will
only make the processor loading worse. Instead, we assume that the data
in the buffer will remain valid after the callback returns, at least
until it is overwritten by new data.

It is still possible for us to lose data if we can't process it quickly
enough. However, we can now detect this loss of data when the fifo is
almost full, and correct the timestamp for the lost block/blocks.
2014-02-22 23:11:13 +00:00
Adam Cécile (Le_Vert) b921d80e7f Typo fixes 2013-10-10 00:44:58 +02:00
Malcolm Robb 11502e9ec9 Extra list decoding for DF-0 and DF-16
Extra list decoding for DF-0 and DF-16
Tidy up a few things
Change version number
2013-10-04 18:33:49 +01:00
Malcolm Robb fa004fc38a DF-11 SI/II Detection changes
Don't allow detection of DF-11 SI/II until we have received at least one
DF-11 for the aircraft with an SI/II of zero.

Previous versions would allow an ICAOAddr to be marked as valid if a
DF-11 was received where the crc was less than 80. This is required for
SI/II detection where the SI/II is overlaid on the crc field. However,
this also decreaces the security of the crc. It is possible for a
corrupt message to result in a crc value of between 1 and 79, and this
will lead to an invalid ICAOAddr being marked as received.

To try and prevent this, do not allow detection of DF-11 II/SI fields
until at least one DF-11 crc=0 has been received. Once this happens, we
ca be fairly sure that this aircraft really is within range, and so
II/SI detection can e used.
2013-10-04 10:34:26 +01:00
Malcolm Robb 5b5424df3b View1090 WinXP bugfix
Updated the way socket handles are used in View1090 to maintain
compatibility between UNIX and Windows.

Added the initial attempt at a Planeplotter uploader
2013-09-27 15:01:46 +01:00
Malcolm Robb 6997715fed Split into separate module files
Ok - this is likely to upset some people. Up until now, the vast
majority of the code has been in just one file - dump1090.c. This file
has grown so that it was approaching of 5000 lines long, and it was
becoming unmanagable. So I've split the file into several modules,
hopefully along fairly logical boundaries. The files are :

1) dump1090.c : Basically just the main() entry function, the help
function, the RTL dongle hardware interface, and a few orphan functions
that  don't really fit anywhere else.

2) mode_s.c : This contains all the mode S / ADSB decoding functions.

3) mode_ac.c : This contains all the mode A & C decoding functions

4) interactive.c : This contains all the functions to maintain an
internal list of aircraft seen over the last period, and functions to
print them out to the local console.

5) net_io.c : This contains all the network input/output functions
allowing data to be passed in/out to/from other receivers, in formats
such as SBS-1/3, Beast, AVR and JavaScript.

Hopefully this should provide an easier way forward if/when more
functions are added.
2013-08-19 18:57:03 +01:00