1415 Commits

Author SHA1 Message Date
Jan Mulder
84eb59c3ce Prevent buffer overrun
When compiled with older Microsoft libraries, the unsafe implemention of
snprintf results in non-null terminated strings, causing numerous subsequent
issues. This fix just enlarges the used buffer to accommdate longer strings.
A more complete solution would include the use more recent Microsoft libraries in
the build process. The larger buffer is still need then, to prevent trucated
(but proper null terminated) strings.

ref: https://github.com/Subsurface-divelog/subsurface/issues/301

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-12 12:45:17 +02:00
Dirk Hohndel
ca04147126 Merge pull request #2 from torvalds/upstream-from-jef
Pull upstream updates from jef
v4.6.3 v4.6.2 v4.6.1
2017-02-01 21:49:21 -08:00
Jef Driesen
0832f97492 Fix the name of the Aqualung i550
The Aqualung i550 doesn't have a "T" (which probably stands for
transmitter) in its name.
2017-02-01 08:32:01 +01:00
Jef Driesen
9cb6856bfb Fix the ndl/deco and rbt samples
The Air Time Remaining (ATR) and Dive Time Remaining (DTR) fields have
been swapped.
2017-01-30 20:54:59 +01:00
Jef Driesen
ae954af768 Parse the sample interval correctly
The Cressi Drake supports a sample interval of 1, 2, 3 and 4 seconds.
2017-01-23 08:40:00 +01:00
Jef Driesen
7b589cab9d Merge branch 'i450t' 2017-01-19 22:12:17 +01:00
Jef Driesen
e5805f3f7d Fix the Aqualung i450T time samples
The Aqualung i450T appears to ignore the fixed sample rate and instead
store a timestamp in each sample.

The presence of the surface samples in combination with this timestamp
based format is odd. Even the official Diverlog software is confused:
the Windows versions seems to ignore them, but the Mac version takes
them into account.
2017-01-19 22:11:48 +01:00
Jef Driesen
8a4c1f1ef7 Split the raw data into multiple vendor samples
After the previous commit, the raw data is now reported with one large
vendor sample. Because that makes the data more difficult to interpret
(for example during debugging), a small helper function is added to
split the data again in multiple vendor samples.
2017-01-19 22:11:48 +01:00
Jef Driesen
7c0f8f9b9d Output samples only once all raw data is available
Originally, the time and vendor sample values are emitted immediately
after the previous sample is complete. This is now postponed until all
raw samples are available.

This will be required for the Aqualung i450t. That model appears to
ignore the fixed sample rate and instead store a timestamp in each
sample. That means the timestamp is only available once the last raw
sample data has been reached.
2017-01-19 22:06:52 +01:00
Jef Driesen
0429ea146e Fix the length check 2017-01-19 22:06:31 +01:00
Jef Driesen
ef47084e05 Skip the extra samples one by one
Skipping the extra samples by increasing the length is not always
reliable. If there are empty samples present, they will get skipped
instead of the real samples. And if the number of samples isn't an exact
multiple of the samplerate, we're accessing data beyond the end of the
dive profile.
2017-01-19 22:06:31 +01:00
Jef Driesen
ef1e64ac03 Fix the memory layout for the Hollis DG03
The profile ringbuffer ends at 0xFE00 instead of 0x10000.
2017-01-19 22:05:20 +01:00
Jef Driesen
3c17132a55 Implement ndl/deco for the Hollis DG03 2017-01-19 22:05:20 +01:00
Linus Torvalds
71cf0a5c69 Merge branch 'master' of git://git.libdivecomputer.org/libdivecomputer into sync-with-upstream
Merge upstream libdivecomputer changes from Jef Driesen.

The most notable one is how libdivecomputer no longer sends the
GASCHANGE events, but uses DC_SAMPLE_GASMIX instead.

We still turn it into a SAMPLE_EVENT_GASCHANGE2 event internally in
subsurface, since we want all the normal event handling to trigger.

* 'master' of git://git.libdivecomputer.org/libdivecomputer: (21 commits)
  Document the date/time functions
  Document the public api with man pages
  Add support for the Cressi Drake
  Detect overwritten dive profiles
  Ignore tank pressure if no sensor is attached
  Add support for the tank field
  Add support for the salinity field
  Use the sample interval from the settings
  Update the Aqualung i750TC parser
  Toggle the DTR line during setup
  Implement the read function
  Add doxygen documentation to the build system
  Add support for the Aqualung i750TC
  Fix the Windows version resource build
  Force the dive mode to gauge
  Add support for the dive mode
  Report the initial gas mix on the first sample
  Remove the deprecated gas change events
  Add support for the Hollis DG02.
  Add support for the Oceanic F10.
  ...
2017-01-16 16:01:10 -08:00
Kristaps Dzonsons
6c356604ec Document the date/time functions 2017-01-12 19:03:28 +01:00
Anton Lundin
3f74840f4c Fix bug in ostc deco info string parsing
The code was just if instead of else if by accident.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
v4.6.0
2017-01-08 14:16:17 -08:00
Anton Lundin
2e650b68ae Teach ostc deco model info strings about OSTC4 VPM
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-08 13:49:06 -08:00
Anton Lundin
6fccf5923f Correct shearwater Deco model info string
The literal % where in the wrong place.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-08 13:49:06 -08:00
Anton Lundin
a6421b2f7b Correct firmware string for OSTC4
OSTC4 stores firmware in another format than OSTC3's.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-08 11:54:49 -08:00
Anton Lundin
19b560d9b2 Fix logging of Custom Write
This way we actually trace print the written buffer, even if the caller
doesn't care about how much data he/she actually wrote.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-08 11:54:49 -08:00
Kristaps Dzonsons
77b0cebb35 Document the public api with man pages 2017-01-07 13:41:07 +01:00
Jef Driesen
07dcc8998b Add support for the Cressi Drake
The Cressi Drake is a mainly a freedive computer. The data format is
almost identical to the Leonardo. The main difference is that a single
dive now contains an entire freedive session. Each freedive in the
session is delimited with a 4 byte header containing the surface
interval and a special marker.
2016-12-30 22:25:14 +01:00
Jef Driesen
3dbfe9d66d Detect overwritten dive profiles
The logbook entries are stored separately from the profile data. If the
profile ringbuffer is filled faster than the logbook ringbuffer, then
the oldest logbook entries can still point to profile data that has
already been overwritten with newer data.

To detect such overwritten profile data, we keep track of the remaining
space in the profile ringbuffer.
2016-12-30 10:01:39 +01:00
Jef Driesen
8c71aebe45 Merge branch 'iconhd' 2016-12-23 20:38:49 +01:00
Jef Driesen
7c7c62dab2 Ignore tank pressure if no sensor is attached
If no tank pressure sensor is attached, the extra 8 bytes with the tank
info are still present, but the recorded tank pressure value is always
zero.
2016-12-23 20:00:05 +01:00
Jef Driesen
f74e354d68 Add support for the tank field 2016-12-23 19:50:13 +01:00
Jef Driesen
9d95870f78 Add support for the salinity field 2016-12-21 10:20:11 +01:00
Jef Driesen
8c95180578 Use the sample interval from the settings
The sample interval is stored in the settings, and thus there is no need
to use a hardcoded value. In practice all dives appear to be using the
default value (5 seconds), so this is more about being future proof.
2016-12-21 10:08:04 +01:00
Jef Driesen
296b13947f Update the Aqualung i750TC parser
The Aqualung i750TC data format appears identical to the Oceanic VTX
format. Therefore the i750TC parser is updated to match with the VTX
parser.
2016-12-06 08:47:11 +01:00
Jef Driesen
7778533bdf Toggle the DTR line during setup
On linux, several users are reporting download problems, while on
windows everything works fine. Simply toggling the DTR line appears to
fix the problem.

A possible explanation is that on windows, the SetCommState() function
not only configures the serial protocol parameters, but also initializes
the DTR and RTS lines. In the libdivecomputer implementation the default
state is enabled (DTR_CONTROL_ENABLE and RTS_CONTROL_ENABLE). The result
is that the DTR line gets automatically initialized to enabled, and then
manually disabled again.

On linux, the DTR and RTS lines are not automatically initialized during
configuration, and need to be controlled explicitely. The result is that
the DTR line ends up disabled without being toggled.
2016-11-29 10:14:28 +01:00
Jef Driesen
c3dc368163 Implement the read function
The read command appears to be limited to the range 0x1000-0x1100. That
range seems to correspond with the first 256 bytes of the full memory
dump. The packet size of 32 bytes is an arbitrary choice.
2016-11-29 08:54:30 +01:00
Ryan McLean
39aa859d19 Add doxygen documentation to the build system 2016-11-22 20:25:50 +01:00
Jef Driesen
61f3031364 Add support for the Aqualung i750TC 2016-11-12 16:05:50 +01:00
Jef Driesen
4d5bc22242 Fix the Windows version resource build
When building the Windows version resource, the -DHAVE_CONFIG_H option
isn't passed to resource compiler automatically. The result is that
development builds don't have their git revision embedded in the DLL.
2016-11-07 10:15:52 +01:00
Jef Driesen
18995e83a8 Force the dive mode to gauge
The Citizen Hyper Aqualand supports gauge mode only.
2016-11-04 19:53:30 +01:00
Jef Driesen
385c1850cb Add support for the dive mode
The dive mode is stored in each sample, and can change during the dive.
In order to report a single value for the entire dive, we assume the
value of the first sample is representive for the entire dive. For
example a dive started as a CC dive but with a bailout to OC during the
dive, is still considered to be a CC dive.

A warning is generated if the dive mode changes.
2016-11-04 19:53:30 +01:00
Jef Driesen
390b5fe553 Report the initial gas mix on the first sample
For dives with multiple gas mixes, an application doesn't have enough
info to figure out which one is the initial gas mix. Usually it's the
first gas mix, but that's not guaranteed. Reporting the intial gas mix
on the first sample avoids this problem.
2016-11-04 19:26:21 +01:00
Jef Driesen
d0dbd1f6fd Remove the deprecated gas change events
The new gas mix sample has been around for a while now, and we're not
going to maintain the deprecated events forever.
2016-11-04 19:24:54 +01:00
Jef Driesen
590882cd1d Add support for the Hollis DG02. 2016-10-04 08:21:11 +02:00
Jef Driesen
8ad3e6322e Add support for the Oceanic F10.
This appears to be an Oceanic branded version of the Aeris F10.
2016-10-01 10:49:02 +02:00
Linus Torvalds
534dd2f34b Merge tag 'v0.5.0' of git://git.libdivecomputer.org/libdivecomputer into Subsurface-branch
Merge upstream version 0.5.0.

Some small updates from Jef Driesen since the last sync, but let's sync
with the real 0.5.0 release.

* tag 'v0.5.0' of git://git.libdivecomputer.org/libdivecomputer:
  Release version 0.5.0.
  Include the public header in the implementation file.
  Add explicit casts for the msvc C++ compiler.
  Add some workarounds for the msvc compiler.
  Update the msvc project file.
  Add missing header files to the Makefiles.
  Add support for the Subgear XP-Air
2016-09-30 14:10:59 -07:00
Jef Driesen
8aa8bbebd5 Post release version bump to 0.6.0. 2016-09-30 21:20:06 +02:00
Jef Driesen
ba0e7224b0 Release version 0.5.0. v0.5.0 2016-09-30 21:17:08 +02:00
Jef Driesen
1d94d3504f Merge branch 'msvc' 2016-09-29 22:41:12 +02:00
Jef Driesen
81c1944604 Include the public header in the implementation file.
In the public header files, all symbols are marked extern C. When using
a C compiler, there is usually no problem if the header isn't included
in the C file. But the msvc build system uses the C++ compiler (due to
the use of some C99 features not supported by the msvc C compiler).
2016-09-28 15:17:54 +02:00
Jef Driesen
e7ceb96627 Add explicit casts for the msvc C++ compiler. 2016-09-28 15:17:54 +02:00
Jef Driesen
53c75860a7 Add some workarounds for the msvc compiler. 2016-09-28 15:17:54 +02:00
Jef Driesen
995cfd4bbd Update the msvc project file. 2016-09-28 14:50:56 +02:00
Jef Driesen
7714a57c44 Add missing header files to the Makefiles.
To be able to generate a distribution tarball, all files need to be
listed explicitely.
2016-09-28 14:49:52 +02:00
Janice
3cb29abfaa Add support for the Subgear XP-Air 2016-09-24 10:07:15 +02:00