Commit graph

1146 commits

Author SHA1 Message Date
Malcolm Robb f011f07e9f Tidy up ModeA/C mm and a structure
If --modeac is specified, then the program will be building an aircraft
list. Calculate the altitude when we create the aircraft structure (a) ,
and then back copy it into the mm structure. This avoids us having to do
a second ModeAtoModeC conversion in the list output display.

Also - bug fix in the ns_vel calculation.
2013-05-09 16:40:04 +01:00
terribl 6968bf92a6 Splitted gmap.html to multiple files in new 'public_html'-directory.
Changes to 'dump1090.c'-file made accordingly.

	modified:   .gitignore
	modified:   dump1090.c
	deleted:    gmap.html
	new file:   public_html/gmap.html
	new file:   public_html/script.js
	new file:   public_html/style.css
2013-05-09 17:59:26 +03:00
Malcolm Robb fc7d1e27c9 Complete the bFlags decoding
Update the bFlags structure member to indicate which other structure
members contain decoded values.

Also, trim out mm structure members that are simple bitwise ands from
the raw data, unless the results are used in lots of places whereby
decoding them once is more efficient.
2013-05-09 15:29:25 +01:00
Malcolm Robb a3d62f96b7 VK1ET : More Decoding of DF-17 ground reports
Extend the DF-17 CPR decoding to use User Lat/Lon for ground positions.

Also start implementing a bFlags structure variable to indicate which
fields in the mm and a data structures contain valid values.
2013-05-09 15:06:07 +01:00
Malcolm Robb cc464b0a34 User Lat/Lon setting
Based on initial code supplied by VK1ET

Allow the user to specify their receivers (technically their aerials)
physical location. This is required for decoding ground positions, and
also for uploading aircraft data to various sharer sites.

The position can be hardwired by setting the MODES_USER_LATITUDE_DFLT
and MODES_USER_LONGITUDE_DFLT constants before compilation, or entered
at runtime via the new command line switches --lat and --lon.   Either
way, the values are checked for validity before use.
2013-05-09 11:29:18 +01:00
Malcolm Robb 5f009a3264 VK1ET ; Decode DF-17 ground position reports 2013-05-09 00:40:57 +01:00
Malcolm Robb 6b53c9e73a Move the clearing of mm for modeA/C
Only clear mm after we are sure we have got a Mode A/C. This reduces
processor load.

Also tidy up some Linux compiler warnings that result from the last
change.
2013-05-08 22:38:31 +01:00
Malcolm Robb 8048cbec6b Better decoding of DF-17 Airborne Velocity
Based on a submission by VK1ET. Fully decode DF-17, metype 19. Take care
to only update fields that are valid in the data.

Also, initialise (to zero) the mm structures before use
2013-05-08 22:16:38 +01:00
Malcolm Robb 6af4bb7431 VK1ET : Only Decode valid AC12 and AC13 altitudes
Decode DF17 altitudes only if valid (i.e. must be a non-zero field)
2013-05-08 20:13:11 +01:00
Malcolm Robb 8efe64982a Tidy up some comments and initialisation 2013-05-08 19:48:08 +01:00
Malcolm Robb dd72fc6dd5 VK1ET : Allow stats in --interactive mode 2013-05-08 19:38:10 +01:00
Malcolm Robb fb5ef77cd1 VK1ET : Fix AC12 Altitude decoding 2013-05-08 19:34:47 +01:00
Malcolm Robb 71ace95fd4 Additional Timestamps for Lat Lon
1) Implement additional timestamps to remember when a new Lat/Lon value
is generated.

2) Increase callsign[] character array to 16 chars  to make it long word
aligned.

3) Change some more comments from /* to //
2013-05-07 21:52:54 +01:00
Malcolm Robb ed076d0d98 Change initialisation of structures
Use memset to clear entire structures at initial creation to zero, and
then populate values that should not be zero. Do this rather than
individually clear each structure member to zero.

This should be faster, plus it's safer when new structure members are
added because you don't have to remember to initialise them.
2013-05-02 13:05:25 +01:00
Malcolm Robb 8870de2b9a Update --interactive with DF20/21 callsigns 2013-05-01 12:54:37 +01:00
Malcolm Robb 5457c5b177 Tidy DF17 print output routine 2013-04-30 18:25:32 +01:00
Malcolm Robb 36778f1284 Extract callsign from DF20 and DF21 2013-04-30 18:18:37 +01:00
Malcolm Robb 14c54599ac Improve callsign extraction from DF17
Use 32 bit registers to hold multiple characters and shift them. This
removes the need for multiple memory reads.

Also tidy up the DF-17 extraction routine to make it more readable.
2013-04-30 18:12:18 +01:00
Malcolm Robb 539faaaf27 Rename Gillham conversion function
ICAO documents refer to AC13 for altitude encoding and ID13 for squawk
wncoding. Rename decodeGillhamField to decodeID13Field to better
represent this.
2013-04-30 18:07:16 +01:00
Malcolm Robb 9783b4786a Generate an average Signal Strength
Remember the last 8 signal strengths for each aircraft and average them
for --interactive display. This produces a less jittery indication.
2013-04-30 18:03:30 +01:00
Malcolm Robb a296f2783f Make stats gathering conditional on Modes.stats
There is a quite complex if/else construct for gathering statistics
inside the main decodeModeS loop. To speed the loop up when not
gathering statistics, make the whole construct conditional on Modes.stat
being set.

Also tidy up a few comments
2013-04-30 10:46:23 +01:00
Malcolm Robb 2e21367f85 Calculate DF and size in decodeModeMessage
Allow the decodeModeMessage function to re-calculate msgtype and
msgbits. This makes the code a bit more portable by not requiring the
calling function to fill in these fields before the call.
2013-04-30 10:41:48 +01:00
Malcolm Robb c81498a0d0 Improve DF field error correction speed
Use bitmasks to speed up the detection of valid and invalid ICAO DF
field types.
2013-04-30 10:35:52 +01:00
Malcolm Robb 8d65abd317 Sanity Check on msglen after decoding
Add a sanity check to ensure that msglen is consistent with the DF type.
2013-04-30 10:32:23 +01:00
Malcolm Robb 5f7ed42050 VK1ET : Ctrl/C and other cleanup code
Changes supplied by John VK1ET.

This tidies up the thread termination, which then allows for use of [a
trapped] Ctrl/C to cleanly terminate the program and dump stats if flag
set.
2013-04-29 22:14:06 +01:00
Malcolm Robb 50cedd7fe2 Major re-write of decodeModesMessage
Lots of changes to the decodeModesMessages() function, and associated
helper functions, with the aim of speeding the code up by reducing the
number of calls to the CRC functions. Also, only update the mm variables
which are part of the message we're decoding.

Change the way CRC's are generated and checked.
Change the way single and double bit error is implemented.
General tidy up of the function to make it more readable.
2013-04-29 18:53:11 +01:00
Malcolm Robb e9b463d25c Update displayModesMessage()
Update displayModesMessage() to show additional ICAO defined DF types.
2013-04-29 18:39:40 +01:00
Malcolm Robb 19c11509e7 Mode S Gillham altitude changes
Modify all the Mode=S Gillham altitude decoding to use a new function
decodeGillhamField()

Change the Mode-S signal strength so that it rounds to the nearest
integer
2013-04-29 18:33:59 +01:00
Malcolm Robb e161b7662c DF Error detection and Correction
Added additional error detection and correction to the DF field of the
first byte in every ModeS frame.
2013-04-29 01:30:12 +01:00
Malcolm Robb 7cf79580a4 Change the message length decision
Assume that DF0-DF15 are all short 56 bit messages
Assume that DF16-DF31 are all long 112 bit messages

This helps us error detect and error recover for bits in the first byte
2013-04-28 20:53:30 +01:00
Malcolm Robb 748f2f5e91 Adjust --interactive display
Allow 8 character Longitudes to cope with -179.999

Change the type of signalLevel to unsigned chae. Negative signal levels
make no sense.
2013-04-28 16:24:33 +01:00
Malcolm Robb 8ed0574ac8 Implement 100 ft Altitudes
The DF's for altitude include a Q bit to distinguish either 100ft or
25ft altitude encoding. This version implements the 100ft increments
used by older aircraft. These codes are basically ModeC altitudes
transmitted over ModeS.
2013-04-28 02:17:57 +01:00
Malcolm Robb 05187f76e7 Add items to --interactive display
Reformat the --interactive display to show more information

Add a "Mode" column. This displays the The primary message type "S" or
"A" plus any matching modes "a" and/or "c". Requires --modeac switch.

Add a "Sig" column to show the signal strength.
2013-04-27 00:18:14 +01:00
Malcolm Robb 4d370bd247 Change default for error correction to OFF
Add a --fix command line switch to enable error correction using CRC.
Change the default to OFF/Disabled.

Error correction can very occasionally result in an incorrect solution
to the crc equation.  It also takes significant CPU work for very few
corrected results. Therefore, the default has been changed to OFF, but
you can re-enable it if you wish by using the --fix command line switch.
2013-04-26 10:12:47 +01:00
Malcolm Robb f77a85e8b8 VK1ET : Additions to check fflags
Implement changes suggested by John/VK1ET

Changes to cprNFunction to ensure fflag {was 'isodd'} is used as a flag.
Fix to decodeCPRrelative to pass 'surface' flag.
2013-04-26 09:49:53 +01:00
Malcolm Robb 2acb0947f0 Changes to Mode A/C/S matchup code
Try to improve the matching of ModeA/C codes to Known Mode-S
2013-04-26 01:40:52 +01:00
Malcolm Robb 25f92e54ba Change Squawk/ModeA code
The original code stores the squawk as a decimal (base 10) value. Change
this to a hex value to reduce the amount of maths required to convert
the input binary value..

Rename all the variables used to store the squawk to "modeA", rather
than variously identity, squawk and modeA.
2013-04-25 23:22:34 +01:00
Malcolm Robb f9c1dc1da5 Remove duplicate varbles
Several variables within structures contain the same information in
different forms.

The aircraft structure contains addr and hexaddr. Hexaddr is a printable
string version of addr. However, hexaddr is only ever used in printf
statments, so we can use printf(%06x) to print addr. This saves a printf
for every received command.

The modesMessage structure contains addr, and aa1,aa2,aa3 as separate
bytes. aa1,aa2 and aa3 are only ever used to construct addr, and to
print out. Therefore, we can use addr instead of them..
2013-04-25 21:17:00 +01:00
Malcolm Robb 3766492067 Change Mode-A/C to Mode-S detection
The original code made an attempt to reconcile a newly arrived ModeA/C
message with every known Mode-S report at the time of detection.
However, the results of matching up Modes A/C and S are only used in the
interactive display routine, and that is only called periodically from
within the BackgroundTasks loop.

Doing the matching on every ModeA/C arrival incurs quite a large CPU
processing load. Moving the matching up routine to the backgroundTasks
loop means that the task is performed muck less frequently and therefore
uses less CPU time.
2013-04-24 23:47:08 +01:00
Malcolm Robb 3dbc0efffc VK1ET : Decode mode ASCII hex input message types
Modifications entirely base on code supplied by John VK1ET.

Supports additional AVR raw ASCII input message stream types
2013-04-24 20:46:59 +01:00
Malcolm Robb a04e399d7e VK1ET : Implement Relative CPR decoding
Modifications entirely base on code supplied by John VK1ET.

Implements relative CPR Lat/Long decoding for --interactive display
2013-04-24 20:24:46 +01:00
Malcolm Robb b78b60677c Improvements to Mode A/C display
Allow a greater range and negative values for Mode C (down to -1200
feet)

Stop attempting to feed ModeA/C data to SBS Output stream.

Allow Mode A only matches to Mode-S squawks when the Mode A code does
not conflict with any possible (legal) Mode C code.

Allow Mode C matches to track aircraft climbing and descending
relatively slowly. This also helps when trying to match Mode-S altitudes
which are 25 foot increments, with Mode C altitudes which are in 100
foot increments.
2013-04-24 00:13:18 +01:00
Malcolm Robb d63ac81a6a Updated comments, ,no code changes 2013-04-23 22:18:15 +01:00
Malcolm Robb 9fff65ba58 Implement Mode A/C decoding
First attempt at decoding legacy SSR Modes A and C.

If the command line switch --modeac is used, the program will now
attempt to recover Mode A/C signals contained in the raw I/Q data
stream. The current recovery mechanism is quite strict and does not cope
well with overlapping and corrupt SSR replies. I estimate that less than
20% of possible returns are decoded correctly. Hopefully over the next
few iterations this can be improved.

If outputting raw data it is recommended to use the --net-ro-size and
--net-ro-rate command line options to reduce the number of very small
ethernet packets that will be generated by mode A/C replies.
2013-04-22 23:31:59 +01:00
Malcolm Robb 39cb96f24b Fix several bugs in input/output fromat
Thanks to vk1et for these.

1) Correct for additional timestamp langth in raw output buffer when
using mlat mode

2) Don't output a timestamp when the message has been received from a
remote site (the internet). This is to avoid upsetting MLAT because
there is an indeterminate delay between reception at the remote site and
subsequent message arrival in the local dump1090 instance.

3) Allow @ character for raw data input with timestamp, and correctly
calculate the length.
2013-04-20 11:29:27 +01:00
Malcolm Robb 11265089b4 Fix Bug in Beast Mode Output
Original code put the signal strength in before the timestamp. It should
be after.

Also add some code to support MODE A/C output at a future date.
2013-04-19 15:29:39 +01:00
Malcolm Robb e98728108c Bug fix in vertical sign
Incorrect shift amount when detecting vertical rate sign.  Thanks
John-vk1et.
2013-04-19 09:32:34 +01:00
Malcolm Robb 3d25f4bf1a Changes to prevent stale output in SBS-1 format
The original code calculates Lat/Long only if it receives two DF-17
(subtype 9 or 18) within one second of each other. I have no idea why.
It then caches the results in the aircrafts data structure for use in
the --interactive display.

When SBS-1 style ASCII output is selected (port 30003) the code does not
attempt to calculate Lat/Long from the data just received - instead it
picks it up from the cached information in the aircraft's data
structure.

However, if the data isn't being updated this results in stale Lat/Long
being sent out. This is most likely to occur when the aircraft is at the
extreme edge of the receivers range when it may be getting some DF-17s
containing Lat/Long, but not 2 per second. The program will continue
sending the stale data until the aircraft finally times out (default 60
seconds)

I have modified the code to include a sbsflags variable in the aircraft
data structure. When a new Lat/Long is decoded and put into the
structure, a bit is set to indicate SBS_LAT_LONG_FRESH. Then, once the
Lat/Long is output the first time, the bit is cleared. Thereafter the
code will not populate the Lat/Long fields in the output message until
SBS_LAT_LONG_FRESH is set again.
2013-04-17 23:09:01 +01:00
Malcolm Robb bbcf68cf11 Nunojpg Southern Hemisphere bug fix + 1
1) Incorporate nunojpg southern hemisphere bug fix
2) Initialise Modes.stat_DF_Corrected variable
2013-04-17 20:09:49 +01:00
Malcolm Robb a75442d11d Up issue the version and commit
Version 1.01.1503.13
2013-04-15 23:26:12 +01:00