1244 Commits

Author SHA1 Message Date
Linus Torvalds
c6b681a753 Initial Suunto EON Steel CCR support
This does the basic divemode and setpoint parsing for the EON Steel, and
gets the CCR download right in the big picture.

The cylinder information is still confusing and incorrect, but this is a
big step in the right direction.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-16 16:26:49 +02:00
Linus Torvalds
84111fe606 Suunto EON Steel: add descriptor debugging output
.. every time I look for a new feature I add debug code to print out all
the descriptors.  So let's just do it once and for all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-16 16:26:49 +02:00
Dirk Hohndel
eb61dc4c75 Add tank size reporting for Suunto EON Steel
Sadly the data we get from the EON Steel is a bit of a mess.
It doesn't really tell us if the data is metric or imperial (it always sends
both wet volume and working pressure). And in imperial mode the Suunto
engineers seem a bit confused. The pressure given (entered on the dive computer
in psi) is sent to us not in bar, not in atm... it's "something". As far as I
can tell it's a constant factor of 1.00069182389937 different from bar.
And the wet sizes are a bit to small to get the cuft size the user entered.
But instead of trying to guess and fix the mess, we just pass it through...

So this is somewhat useful, but not really what most users will want.

Linus started this commit with a few lines that parsed the right values out of
the data stream from the Suunto EON Steel. I then added the implementation of
the infrastructure to convert the raw data and report it back to the caller.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-16 16:26:49 +02:00
Jef Driesen
decfa24f92 Fix the gas mix parsing for the Aladin Tec 2G.
Unlike the other models, the Aladin Tec 2G uses only a single byte to
store the oxygen percentage, and there is no need to manually re-map the
deco mix.

Normally, the oxygen percentage is stored using two bytes (little endian
byte order). Thus for a device supporting two gas mixes, four bytes will
be used, and the corresponding gas mix id for each byte is as follows:

  ID: 0 0 1 1

After re-mapping the id of the deco mix, this becomes:

  ID: 0 0 2 2

Since oxygen percentages are limited to the range 0-100%, the highest
byte (marked with an X) should always be zero and can thus be ignored:

  ID: 0 X 2 X

Now, because an oxygen percentage of zero indicates a disabled gas mix,
this is equivalent to a device supporting three (or even four) gas
mixes, each stored using only a single byte:

  ID: 0 1 2 3

We can take advantage of this knowledge to avoid having to re-map the
deco mix id.
2016-09-02 16:34:06 +02:00
Jef Driesen
3b179e7058 Add support for the Sherwood Vision. 2016-08-25 09:10:06 +02:00
Jef Driesen
c506be93f9 Fix the decoding of the maximum depth.
Several devices (e.g. Oceanic Geo, Oceanic Veo 2.0 and Tusa Zen) report
a maximum depth that is clearly too large. The problem is easily fixed
by ignoring the higher bits. The exact bit mask is an educated guess. A
12 bit value is plausible because it's also used for the sample depths.
2016-08-23 07:58:25 +02:00
Jef Driesen
3b18d4a448 Improve the default layout detection.
Select the default memory layout for unsupported devices based on the
amount of memory indicated in the version string. This allows to
download a full memory dump.
2016-08-21 13:27:39 +02:00
Jef Driesen
6d3fbb7e6d Add a warning for unsupported devices. 2016-08-21 13:27:06 +02:00
Jef Driesen
dfa191c9bc Fix the temperature for the Tusa Zen Air. 2016-08-20 21:22:19 +02:00
Jef Driesen
f666cb8cb3 Add support for the Aqualung i550T. 2016-08-20 21:20:01 +02:00
Jef Driesen
2e40d35da4 Merge branch 'uwatec' 2016-08-18 23:32:41 +02:00
Jef Driesen
0ab2d8ccda Use the new settings field for the salinity.
Since the salinity bit is stored in the settings, there is no need for a
separate salinity entry in the header tables.
2016-08-17 14:09:52 +02:00
Jef Driesen
bfcd707889 Fix the parsing of freedives.
In freedive mode the sample rate is only 1 second instead of 4 seconds.
The tank pressure fields appear to be re-used for some other (unknown)
purposes, and should be ignored.
2016-08-17 14:08:50 +02:00
Jef Driesen
8b0a048175 Detect the gauge and freedive mode correctly.
The gauge and freedive mode bits are stored in the settings field. The
location of the gauge bit appears to be the same for all models. For the
freedive bit it depends on the model, and also not all models support
it.
2016-08-17 08:10:36 +02:00
Jef Driesen
1226b47c6d Add the salinity field for the Aladin Tec. 2016-08-17 08:10:11 +02:00
Jef Driesen
769d90aca2 Add support for the Scubapro Mantis 2. 2016-08-14 10:07:45 +02:00
Jef Driesen
af7e7aed19 Fix the decoding of the dive time.
The dive time is stored in two separate bytes: one for the number of
minutes, and another one for the hours. Since we only took into account
the first byte containing the minutes, the divetime for dives longer
than one hour was always too short.
2016-08-12 11:47:41 +02:00
Jef Driesen
ae93a6ab08 Add support for the Scubapro Mantis.
The Scubapro Mantis uses the same model number as the Meridian, and
works out of the box.
2016-08-11 08:57:47 +02:00
Jef Driesen
9e585a9525 Fix the Aeris 500AI serial number.
The Aeris 500AI serial number appears to be located at a slightly
different offset, and with an unusual encoding. It's a BCD encoded
number, but with the digits of each byte swapped.
2016-08-08 09:20:55 +02:00
Jef Driesen
00c2705786 Add the serial number encoding to the layout.
At the moment, the encoding of the serial number is tied to the global
pointer mode. To support devices where this is no longer the case, a new
entry for the serial number encoding is added.
2016-08-08 08:38:23 +02:00
Thomas Gschwind
0a769cdd57 Add salinity and timezone fields to Aladin Tec 2G 2016-08-07 09:31:21 +02:00
Janice
e99b8ac837 Add NDL and RBT for the ATOM31 and I450T 2016-08-05 10:26:07 +02:00
Jef Driesen
b4dc2532e8 Add support for the new extended hardware descriptor.
The latest v2.09 (hwOS) and v1.1.0 (hwOS4) firmware introduced a new
variant of the hardware descriptor command. This extended command
returns:

 - a 16 bit hardware descriptor
 - a 16 bit feature descriptor
 - an 8 bit model descriptor

The hardware descriptor is backwards compatible with the existing one
(upper bits are all zero for now). For the OSTC4, the feature descriptor
is currently used to indicated the Bonex scooter version (0x01), and the
model descriptor is 0x43. For all other models, the feature and model
descriptors are always zero for now.

For older firmware versions, which do not support the new extended
descriptor yet, there is an automatic fallback to the previous
descriptor.
2016-08-02 10:44:34 +02:00
Jef Driesen
9ef840fc96 Update the OSTC device descriptors.
There are a few new hardware variants since the last update.
2016-07-30 21:40:56 +02:00
Jef Driesen
f94aab3c8e Merge branch 'ostc4' 2016-07-30 21:39:56 +02:00
Jef Driesen
b896847e14 Add a workaround for an OSTC4 firmware bug.
Due to a firmware bug, the deco/ndl info is incorrect for all OSTC4
dives with a firmware older than version 1.0.8. Since it's not possible
to correct the info again, it's ignored and not returned to the
application.
2016-07-30 21:36:55 +02:00
Jef Driesen
ff15b865b2 Fix the decoding of the OSTC4 firmware version.
The OSTC4 firmware version uses four digits for the firmware version
(X.Y.Z.Beta), while all other hwOS models use two digits (X.Y). To
preserve backwards compatibility with the existing two byte data format,
the OSTC4 firmware version is packed into a 16 bit integer as follows:

   XXXX XYYY YYZZ ZZZB

and stored with little endian byte order.
2016-07-30 21:36:55 +02:00
Jef Driesen
2829f7ebf9 Add an ostc3 specific function with the model number.
To be able to pass the OSTC 3 model number to the parser, and preserve
backwards compatibility, we need a new function. The new function should
also be used for the Frog, by passing zero as the model number.

Using the hw_ostc_parser_create() function with the hwos parameter set
to one, is now deprecated but will remain supported for backwards
compatibility.
2016-07-23 23:14:13 +02:00
Jef Driesen
29caab0673 Rename the frog parameter and field to hwos.
The frog parameter and field are not only used for the Frog, but also
for all hwOS based models. Therefore, using the more generic hwos as the
name is more meaningful.
2016-07-23 23:11:30 +02:00
Jef Driesen
ad2257569c Add a new dc_parser_new2 convenience function.
For applications supporting offline parsing (like libdivecomputer's own
dctool application), some device specific knowledge is still required in
order to map a particular model to the corresponding backend. The new
convenience function will take care of that internally.

The already existing dc_parser_new() function does the same, but
requires an open device handle, which makes it unsuitable for offline
parsing.
2016-07-22 21:14:33 +02:00
Jef Driesen
c8b2d89354 Set the default model number.
When the device family is provided without an explicit model number, we
simply choose the first available model. But since new models are being
added all the time, this default model is not guaranteed to remain the
same. That's not desirable because it can alter the behaviour of the
application.

The introduction of the Aeris 500AI is an example of this problem. The
default model in the vtpro family used to be the Oceanic Versa Pro. But
because the Aeris 500AI has a lower model number, it automatically
became the new default model. Since both use a different protocol
variant (MOD vs INTR) they are not interchangable.

The default model is now hardcoded. The best option is of course to
provide the model number explicitly!
2016-07-11 21:49:16 +02:00
Jef Driesen
335539f179 Merge branch 'aeris500ai' 2016-07-11 21:48:58 +02:00
Jef Driesen
92f84b5945 Refactor the oceanic download function.
The large and complex oceanic_common_device_foreach() function is
refactored into two independent helper functions. One for reading the
entries in the logbook ringbuffer, and another for reading the profile
data.
2016-07-11 21:47:29 +02:00
Jef Driesen
aaa7fbe08d Add support for the Aeris 500AI.
The Aeris 500AI is quite different from the other vtpro compatible
models. First, it uses the INTR protocol variant. Next, it doesn't
appear to have a logbook ringbuffer. Instead it supports a new read
logbook index command (0x52) that returns the logbook entries. This
requires a custom implementation of the logbook function.
2016-07-11 21:47:29 +02:00
Jef Driesen
9c251b6814 Ignore samples with all 0xFF bytes. 2016-07-11 21:47:29 +02:00
Jef Driesen
5824254cf5 Add support for the INTR protocol variant.
There are two variants of the vtpro communication protocol: the existing
MOD variant and the new INTR variant. The main difference is in the
initialization sequence, with two completely different response packets:

   MOD--OK_V2.00
   INTR-OK_V1.11

The INTR variant does not appear to return useful information in the
version packet.
2016-07-11 21:47:29 +02:00
Jef Driesen
b41ecd0c15 Add a parameter with the model number. 2016-07-11 21:47:29 +02:00
Jef Driesen
9bae07551f Allow custom logbook and profile functions.
By adding the logbook and profile functions to the vtable, a dive
computer backend can now easily replace the default implementation with
a custom one, without having to duplicate the common code.
2016-07-11 21:47:29 +02:00
Jef Driesen
4ba92e24ef Fix a crash when no dives are present.
To guard applications from divisions by zero, the progress event code
asserts the maximum value should always be non-zero. The eonsteel does
trigger this assert when there are no dives present.
2016-07-11 13:14:15 +02:00
Jef Driesen
1e22760f91 Fix the memory layout for the Aqualung i300.
The profile ringbuffer ends at 0xFE00 instead of 0x10000.
2016-06-23 08:48:45 +02:00
Jef Driesen
47037286a2 Fix the sample rate for the Aqualung i450t. 2016-06-13 15:17:58 +02:00
Jef Driesen
375fe2f6a7 Fix the nitrox gas mix parsing.
Mares Darwin compatible devices support a nitrox mode. The nitrogen
percentage should only be taken into account when the dive mode is set
to nitrox, because the last used value remains in place for air dives.
2016-06-03 08:19:42 +02:00
Jef Driesen
cb3b372b5b Add support for the dive mode field. 2016-06-03 08:13:55 +02:00
Jef Driesen
73a06407b8 Fix the length of the Vyper Novo gas change event.
Just like the Suunto DX, the Vyper Novo uses 5 bytes for the 0x06 gas
change event.
2016-06-02 08:27:24 +02:00
Jef Driesen
8f776cc55e Add support for the Aqualung i300. 2016-05-16 09:06:57 +02:00
Jef Driesen
d1aa9478a4 Merge branch 'refactor' 2016-05-10 20:22:07 +02:00
Jef Driesen
f8417037c6 Convert operating system errors.
Errors reported by system calls are now converted to the corresponding
libdivecomputer status code. This results in a more descriptive and
meaningfull return value.
2016-05-10 11:52:32 +02:00
Jef Driesen
4fd0118d4e Add support for 1.5 stopbits. 2016-05-10 11:35:03 +02:00
Jef Driesen
72bd82f0a3 Add support for space and mark parity. 2016-05-10 11:35:03 +02:00
Jef Driesen
84563c6303 Refactor the internal serial and IrDA api.
The low level serial and IrDA functions are modified to:

 - Use the libdivecomputer namespace prefix.

 - Return a more detailed status code instead of the zero on success and
   negative on error return value. This will allow to return more
   fine-grained error codes.

 - The read and write functions have an additional output parameter to
   return the actual number of bytes transferred. Since these functions
   are not atomic, some data might still be transferred successfully if
   an error occurs.

The dive computer backends are updated to use the new api.
2016-05-10 11:34:57 +02:00