936 Commits

Author SHA1 Message Date
Jef Driesen
b2bc231cb4 Convert imperial tank volume to the metric system.
There are two different ways to specify the volume of a tank. In the
metric system, the tank volume is specified as the water capacity, while
in the imperial system the tank volume is specified as the air capacity
at the surface (1 ATM) when the tank is filled at its working pressure.

To avoid mistakes, the tank volume is now always returned as the metric
volume. For imperial tanks, the tank volume is converted to the metric
representation.
2014-11-13 13:13:07 +01:00
Janice
71fe683922 Don't look for tank pressure information from a GEO 2014-11-10 13:05:33 +01:00
Dirk Hohndel
5e88cf7494 Add missing break in Cobalt support for divemode
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-09 09:59:20 +01:00
Jef Driesen
4a16327322 Fix the tank working pressure for the Cobalt.
The difference between CUFT@PSI and CUFT@BAR is only for the Cobalt user
interface, to allow the user to enter the tank volume independent of the
units configured in the main preferences. Internally the working
pressure is always stored in psi.
2014-11-09 09:20:16 +01:00
Jef Driesen
52a9dc3947 Add support for the Mares Airlab.
The Mares Airlab is actually the same device as the Darwin Air.
2014-11-07 22:12:59 +01:00
Jef Driesen
14a29decd0 Merge branch 'divemode' 2014-11-07 22:12:23 +01:00
Jef Driesen
88159c6fe4 Implement the dive mode for several devices.
The new dive mode field is now supported by devices from these
manufacturers:

 * Atomic Aquatics
 * Heinrichs Weikamp
 * Mares
 * Reefnet
 * Suunto
2014-11-07 22:12:05 +01:00
Jef Driesen
c95ab19e6a Use symbolic constants for the dive mode. 2014-11-07 22:04:16 +01:00
Jef Driesen
651123de53 Add support for parsing the dive mode. 2014-11-07 22:04:16 +01:00
Jef Driesen
7a3d921725 Merge branch 'tanks' 2014-11-07 22:00:25 +01:00
Jef Driesen
25411672dc Implement tank support for the Mares Darwin Air. 2014-11-07 22:00:07 +01:00
Jef Driesen
11cafbaf5f Implement tank support for the Atomic Cobalt. 2014-11-07 22:00:07 +01:00
Jef Driesen
8f9878a1c0 Add support for parsing tank data in the dive header. 2014-11-07 22:00:07 +01:00
Jef Driesen
ed0cbf818d Merge branch 'temperature' 2014-11-07 21:59:31 +01:00
Jef Driesen
52cac91b18 Implement the temperature support for several devices.
The new temperature fields are now supported by devices from these
manufacturers:

 * Atomic Aquatics
 * Heinrichs Weikamp
 * Mares
 * Suunto
 * Uwatec
2014-11-07 21:58:49 +01:00
Jef Driesen
693a452250 Extend temperature with surface, min and max values. 2014-11-07 21:58:49 +01:00
Calle Gunnarsson
a4e5d4234c Cressi Leonardo now reports temperature from dive header
Signed-off-by: Calle Gunnarsson <calle.gunnarsson@gmail.com>
2014-11-07 21:58:49 +01:00
Calle Gunnarsson
cdbc0cd9bd Added support for parsing temperature in the dive header
Devices that only reports a single temperature in the header
will now be able to report it as well when they implement this.

Signed-off-by: Calle Gunnarsson <calle.gunnarsson@gmail.com>
2014-11-07 21:58:49 +01:00
Jef Driesen
60665ec633 Disable exclusive access mode during close.
When closing the slave side of a pseudo terminal, the exclusive access
mode will persists on the master side. The result is that re-opening the
slave side will fail with EBUSY, unless the process has root priviliges.
To workaround this problem, we already introduced an option that enables
better compatibility with pseudo terminals. See commmit
fab606b00a44ea2114a4029ad09b70c66c3049f7 for details.

In my development environment, I always have this option enabled. But
occasionally I also need to test release builds. And then I usually end
up with inaccessible pty's again, because the pty support is disabled by
default for release build.

This problem can easily be avoided by disabling the exclusive access
mode, just before closing the file descriptor.
2014-11-07 09:07:41 +01:00
Dirk Hohndel
d2eacc5c01 Fix temperature parsing for Sherwood Wisdom 3
Adds the new model and treats it like a Wisdom 2 (and many other, similar
versions of the Oceanic Atom2 style dive computers).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 10:03:11 +01:00
Janice McLaughlin
69fec57ed7 Fix the gas mixes for the Aeris A300AI.
The Aeris A300AI supports 4 instead of 3 gas mixes. The offset where the
gas mixes are stored was wrong too.
2014-10-28 09:14:25 +01:00
Jef Driesen
1d2ebd7af1 Fix the header size for the Oceanic VT4 and VT4.1.
This change was already present in the oceanic_atom2_parser_get_field()
function, but not in the oceanic_atom2_parser_samples_foreach()
function. These two should always be kept in sync.

This fixes a bug in the tank pressure detection.
2014-10-28 09:07:18 +01:00
Jef Driesen
853477b3b1 Add support for the Aeris F11.
Most of the changes needed for the F11 are the standard model specific
tweaks. But the F11 also has another interesting "feature". If you try
to download a full memory dump using the standard B1 read command, then
the data starts to repeat after the first 64K. It seems that somehow,
the B1 command can only address the first 64K of the memory. To avoid
this problem, the newer B4 read command needs to be used instead.

This might be a firmware bug, or maybe internally they store the address
in a 12bit variable, which causes the upper bits to get lost? That would
explain the repeating data.
2014-10-27 22:02:04 +01:00
Jef Driesen
af43c80d78 Merge branch 'a300cs' 2014-10-27 21:16:31 +01:00
Jef Driesen
a1ff11e08e Cache the last page to reduce the number of I/O operations.
In bigpage mode, we always read large pages, regardless of the amount of
bytes requested by the caller. Excess bytes are simply discarded. This
is inefficient because the same large page will be downloaded multiple
times, when requesting more than one 16 byte page from the same large
page. By caching the pages internally, we can greatly reduce the amount
of I/O operations.

In practice, applications and also libdivecomputer's internal algorithm
for downloading the dives will typically request contiguous pages, so we
only need to cache the last page.

This implementation is based on ideas and code contributed by Dirk
Hohndel.
2014-10-27 12:24:18 +01:00
Dirk Hohndel
0bcee519e0 Aeris A300CS: detect the number of cylinders used
The A300CS actually tells us how many of the cylinders it considers "in
use".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 12:24:18 +01:00
Dirk Hohndel
7a108f555b Aeris A300CS: add reporting of water type (fresh/salt)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 12:24:18 +01:00
Dirk Hohndel
16fb1c1869 Aeris A300CS: add support for NDL / deco data
Encoded in every sample. The depth is in multiples of 10 feet which gives
somewhat odd metric stop depth - but rounding to full meters would take
care of that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 12:24:18 +01:00
Dirk Hohndel
d89dd952c9 Add initial support for the Aeris A300CS
This is ignoring a ton of data that the dive computer provides. But it
gives profile, tank pressure and temperatures - so it's a start.

This patch adds a set_dtr and set_rts call to the serial interface prior
to interacting with the device. This change is required for the A300CS to
talk to the computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 12:24:18 +01:00
Dirk Hohndel
4fa0f4cc59 Prepare Oceanic infrastructure for multi page reads
Some new Oceanic dive computers like the Aeris A300CS support a new read
command that always reads 256 byte pages instead of 16 byte pages, other
versions support reading 128 byte pages.

This patch adds a field to the oceanic_atom2_device_t structure to
indicate which type of device this is. If bigpage mode is enabled, the
algorithm will always request larger, aligned reads and fall back to
standard 16 byte reads otherwise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 12:24:18 +01:00
Jef Driesen
abe2eab976 Fix the date/time for the Oceanic Pro Plus 3.
The day is stored as a binary value, not a BCD encoded value.
2014-10-25 21:21:43 +02:00
Jef Driesen
8853a1ccd4 Associate the pressure samples with the primary tank.
The primary tank, which is the tank connected to the hose and thus the
tank pressure sensor, it not necessary the first tank. The correct tank
index can be found by searching the array for a gas mix with a sensor id
equal to one.
2014-10-10 21:28:24 +02:00
Jef Driesen
9db9e970cf Convert the gasmix id into an array index.
The gasmix value in the sample data is the id of the gasmix. Depending
how the user manipulated the gasmix settings, this id is not necessary
identical to the index into the gasmix array.  The array index can be
found by searching the array for a mix with the correct id.
2014-10-10 21:28:24 +02:00
Jef Driesen
8edc765e6b Add some more error messages. 2014-10-10 21:27:15 +02:00
Jef Driesen
693bfa3916 Fix the Tusa Zen header size and pressure.
For the Tusa Zen, the header is 16 bytes smaller. With this change, the
gasmixes and the intial temperature are now parsed correctly.

The tank pressure samples have also been disabled manually, because this
is a non-air integrated model that doesn't seem to set the initial tank
pressure to the magic value 10000.
2014-09-14 22:09:48 +02:00
Jef Driesen
5f765f9143 Add support for the Subgear XP-3G. 2014-08-26 22:09:47 +02:00
Jef Driesen
e79bd02f0a Fix a buffer overflow.
The 6 byte logbook entry gets prepended to the profile data. We need to
take this into account when allocating the memory buffer. Under normal
circumstances this shouldn't be a problem, because a single dive is
usually much smaller than the profile ringbuffer. But it's better to be
on the safe side.
2014-08-26 22:08:41 +02:00
Jef Driesen
cde70334b0 Initialize the fingerprint before use.
The fingerprint is used unconditionally, regardless of whether it's
explicitly set by the application or not. Therefore it needs to be
initialized properly.
2014-08-26 22:07:59 +02:00
Jef Driesen
6845d9b77c Fix the Mares Puck 2 memory layout descriptor.
The Mares Puck 2 uses the same memory layout as the Nemo Wide 2. See
commit 322227df7f65da8b4a962f3513e0a10b89cbe29d for more details.
2014-08-21 23:41:20 +02:00
Jef Driesen
84d997fac6 Fix a build error.
Commit 7a851ccb1b9ed9b8906721cb1872b96b35185883 accidentally broke the
build due to a missing line.
2014-08-16 22:46:53 +02:00
Jef Driesen
549207a48b Add suport for the OSTC Sport variant.
Although the OSTC Sport uses bluetooth communication, the new model
remains fully compatible with the OSTC3, because it provides a virtual
serial port interface. As usual, the new model can be detected based on
the serial number.
2014-08-16 17:39:12 +02:00
Jef Driesen
b12d5acb86 Merge branch 'iconhd' 2014-08-14 12:00:03 +02:00
Jef Driesen
7a851ccb1b Add some extra error messages. 2014-08-14 10:20:23 +02:00
Jef Driesen
b0874ea4d9 Disable gas mixes and events in gauge mode.
For a dive in gauge mode, the gas mixes defined in the header should be
ignored, and no gas change event should be emitted. This is done by
hardcoding the number of gas mixes to zero.
2014-08-14 09:52:57 +02:00
Jef Driesen
4f2d71ce49 Cache the parser data internally.
The code to find the offset to the footer and parse the gas mix data is
duplicated in multiple places. Move this code to a single place, and
cache the data in the parser instead.
2014-08-13 16:23:22 +02:00
Jef Driesen
c2f86a7806 Ignore disabled gas mixes.
Gas mixes that have been disabled are stored as a mix with 0% oxygen and
0% helium. This is clearly an invalid gas mix, and it makes no sense to
return it back to the application.
2014-08-09 17:19:36 +02:00
Jef Driesen
ed2b9d34d5 Fix the dive mode detection for the Mares Nemo Air.
For the Nemo Air, a dive mode with the value 2 indicates gauge mode
instead of freedive mode. With this change, all models from the puck
family now use the same values.
2014-08-03 15:49:16 +02:00
Jef Driesen
5826257a79 Use symbolic constants for the model numbers. 2014-08-03 15:03:08 +02:00
Jef Driesen
eb036357a6 Ignore excess samples with the same timestamp.
With a time based sample interval, the maximum number of samples for a
single timestamp should be constant. However in practice some devices
occasionally store one or more additional samples with the same
timestamp.

Ignoring those excess samples, allows the parser to proceed, while still
preserving the strict time based interval for the application.
2014-07-10 12:40:10 +02:00
Jef Driesen
77d53813bd Remove the device specific example applications.
These device specific applications became obsolete long time ago with
the introduction of the universal application.
2014-07-02 17:06:27 +02:00