1306 Commits

Author SHA1 Message Date
Jef Driesen
f83d156fdb Improve the robustness of the IrDA I/O code
The select system call modifies the file descriptor set, and depending
on the underlying implementation also the timeout. Therefore these
parameters should be re-initialized before every call.

The existing code also didn't handle EINTR and EAGAIN correct.
2017-02-16 13:11:14 +01:00
Jef Driesen
24cbff9a9f Fix a few null pointer dereferences 2017-02-16 12:00:41 +01:00
Jef Driesen
e96611cccd Fix the number of gas mixes
The Tusa Zen supports a maximum of only 2 gas mixes.
2017-02-10 19:42:02 +01:00
Jef Driesen
3f9133def9 Always use the sample timestamp as the base value
With a time based sample interval, the number of samples for a single
timestamp should be constant. However in practice some devices
occasionally store fewer samples. Since our sample time is based purely
on the sample interval, it goes completely out of sync with the sample
timestamp. To avoid this problem, the sample timestamp is used as the
base value.

For the Oceanic Pro Plus 2, this problem is very noticable. After about
115 minutes into a dive, the sample interval appears to increase to 60
seconds. Thus, without this fix, the resulting dive time for long dives
is suddenly much shorter than it should be.
2017-02-08 07:43:44 +01: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
Kristaps Dzonsons
6c356604ec Document the date/time functions 2017-01-12 19:03:28 +01: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
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
Jef Driesen
03c252335b Fix the firmware version for the HW Frog.
The firmware version in the dive header is stored at byte offset 32
instead of 34.
2016-09-19 15:15:52 +02:00
Jef Driesen
c3039b4aab Merge branch 'usbhid' 2016-09-19 15:15:36 +02:00
Jef Driesen
417ee6e619 Use the new USB HID backend for the Eon Steel. 2016-09-19 15:04:48 +02:00
Jef Driesen
6c6b144fe0 Add a dummy backend for systems without USB HID support.
This dummy implemantion is used when building without libusb and hidapi.
2016-09-19 15:04:48 +02:00
Jef Driesen
ed2a7c91fe Use the hidapi library on Mac OS X.
On Mac OS X, libusb doesn't work for USB HID devices. We can use the
hidapi library instead. Although the hidapi library supports Linux and
Windows too, we keep using libusb there to avoid the extra dependency.
2016-09-19 15:04:48 +02:00