1008 Commits

Author SHA1 Message Date
Jef Driesen
8b64ce0edc Cache the parser data internally. 2015-03-12 14:13:18 +01:00
Jef Driesen
fb417ee5b5 No gas mix support for the Galileo Trimix yet.
For the Galileo Trimix we don't know yet where and how the gas mixes are
stored. Right now, we just pretend there are no gas mixes available,
which is misleading.
2015-03-12 14:13:17 +01:00
Jef Driesen
bcb2925a25 Fix the Galileo trimix detection.
Originally, I assumed that the trimix firmware update changed the model
number from 0x11 (Galileo) to 0x19 (Galileo Trimix). But that assumption
appears to be wrong because I received data from a Galileo with model
number 0x11, but with the trimix data format. Another explanation might
be that the trimix data format is not specific to the trimix firmware.

Anyway, this is easily fixed by treating both models identically.
2015-03-12 14:12:53 +01:00
Jef Driesen
5a1f1293d2 Disable tank pressure samples for the Aeris Manta.
The Aeris Manta is yet another non-air integrated model that doesn't set
the initial tank pressure to the magic value 10000.
2015-03-06 22:33:10 +01:00
Jef Driesen
90ba491c6d Merge branch 'ostc' 2015-03-06 21:45:39 +01:00
Jef Driesen
3b264d9cfd Add support for the new hardware descriptor.
The latest firmware v1.75 introduced a new hardware descriptor byte to
identify the different models based on their hardware features. This new
hardware descriptor is now used as the libdivecomputer model number. For
older firmware versions, which do not support the descriptor yet, there
is an automatic fallback to the previous method based on the serial
number.
2015-03-06 21:45:02 +01:00
Jef Driesen
bdbe95f221 Detect and report unsupported commands.
When trying to send an unsupported command, the ostc will simply ignore
the command. Instead of echoing the command byte back, the ostc will
immediately send the ready byte, to indicate it's ready to receive the
next command. We can use this to detect unsupported commands, because
the ready byte is a reserved value and guaranteed to never be a valid
command byte.

Normally we don't send invalid commands. But newer firmware version can
always introduce new commands to support new features. To maintain
backwards compatibility with older firmware versions, it's important to
be able to detect unsupported commands and provide a fallback.
2015-03-06 21:45:02 +01:00
Jef Driesen
c7d2bfc9a0 Add support for the Sherwood Amphos Air. 2015-03-04 08:13:53 +01:00
Jef Driesen
da96f0211a Fix the freedive mode for the DG03 and VT3.
The freedive/gauge bits for the Hollis DG03 and Oceanic VT3 are stored
at another location than our initial assumption.
2015-03-04 08:06:39 +01:00
Jef Driesen
f205ef736c Merge branch 'veo' 2015-02-27 10:31:17 +01:00
Jef Driesen
41834a31c7 Fix the freedive mode for the Oceanic Veo 2 and 3.
In freedive mode, the Oceanic Veo 2.0 and 3.0 have samples that are only
4 bytes long, instead of the normal 8 bytes.

The Oceanic VT3 and Hollis DG03 use the same logbook layout, and
although I haven't been able to confirm this with real data, it's very
likely they need the same fix.
2015-02-27 10:18:09 +01:00
Jef Driesen
488c396656 Fix the hour for the Oceanic Veo 2 and 3.
For BCD encoding the hour in a 12 hour clock system, only 5 bits are
required. The extra two bits are used for storing the freedive/gauge
mode.
2015-02-27 10:17:19 +01:00
Jef Driesen
678e75a05a Merge branch 'vtx' 2015-02-21 14:38:28 +01:00
Jef Driesen
bad4dd4342 Add support for the Oceanic VTX.
The Oceanic VTX is very similar to the Aeris A300 CS. The main
difference is the higher baudrate (115200 vs 38400). This is annoying
because without the correct baudrate, no communication is possible and
thus the existing autodetection based on the version packet doesn't
work. As a workaround, we now rely on the model number from the device
descriptor. The consequence is that the user must select the correct
model now (or at least a model with the same baudrate).
2015-02-19 13:47:48 +01:00
Jef Driesen
4dfca21a2b Pass the model number to the open function.
This change will be necessary for the Oceanic VTX, because it uses a
higher baudrate.

To maintain backwards compatibility, the existing function remains
unchanged and a new function is introduced instead.
2015-02-19 13:47:25 +01:00
Jef Driesen
f5d96a081c Extend the retry logic to corrupt data packets.
At the moment, there is only retry logic for the ACK/NAK byte. Corrupt
data packets (e.g. wrong checksum, unexpected length, etc) are treated
as a fatal error. By reading the entire packet inside the retry loop,
all non-fatal errors are automatically taken care off.

This change is necessary for the Oceanic VTX. For some unknown reason,
the device always responds with an invalid data packet when sending the
version command for the first time:

  W: 84 00
  R: 5A 4F ?? 45 41 4E 56 54 58 20 31 42 20 32 30 34 38 E9

There is always one byte missing (marked with question marks), resulting
in a timeout. However, when re-sending the command again, we receive a
valid data packet:

  W: 84 00
  R: 5A 4F 43 45 41 4E 56 54 58 20 31 42 20 32 30 34 38 E9

This might be a firmware bug, because we're observing the exact same
behaviour with the official Oceanlog application.
2015-02-19 13:47:25 +01:00
Jef Driesen
11d9256e43 Use symbolic constants for the commands. 2015-02-19 13:45:13 +01:00
Jef Driesen
5906c113af Merge branch 'freedive' 2015-02-15 19:25:58 +01:00
Jef Driesen
4671a31853 Disable gas mixes in freedive mode. 2015-02-14 21:44:58 +01:00
Jef Driesen
d2fce4ac3b Implement the dive mode field. 2015-02-14 21:44:58 +01:00
Jef Driesen
6f14e996d7 Fix the freedive mode for the Aeris Elite T3.
In freedive mode, the Aeris Elite T3 has samples that are only 2 bytes
long, instead of the normal 8 bytes.

Since there are many other models which support a freedive mode, the new
implemention provides the necessary infrastructure to easily integrate
those other models too.
2015-02-14 21:44:58 +01:00
Jef Driesen
6f23ab9ed7 Fix the depth for the Aeris F11.
Since the size of a sample is only 2 bytes, we were actually reading the
depth value from the next sample.
2015-02-10 21:18:23 +01:00
Jef Driesen
b781fcf73d Add support for the HW OSTC cR.
The OSTC cR is new model for closed circuit (CCR) diving. Under the hood
it's identical to the OSTC 3, but with an S8 connector to interface with
an external oxygen sensor. Since the data format already supports oxygen
sensors, the OSTC cR can be added to the list of supported devices
without any further changes.
2015-02-09 19:47:55 +01:00
Anton Lundin
1d5863d827 Add average depth from OSTC/OSTC3 logbook
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2015-02-09 19:45:30 +01:00
Jef Driesen
b6a3c9b237 Add support for the Scubapro Chromis. 2015-02-09 19:45:17 +01:00
Jef Driesen
6ad341d0c7 Disable tank pressure samples for the Oceanic Geo 2.0.
The Oceanic Geo 2.0 is a non-air integrated model that doesn't seem to
set the initial tank pressure to the magic value 10000.
2015-02-02 09:05:33 +01:00
Anton Lundin
cfd4f4ce17 Have make be more silent by default
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2015-01-21 09:09:02 +01:00
Jef Driesen
d50c9e8d63 Merge branch 'eonsteel' 2015-01-08 16:35:15 +01:00
Linus Torvalds
97a8d41089 Add EON Steel bookmarks, warnings and alarm events
I'd missed these because I'm blind. But mostly because they aren't as
common.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-01-08 08:49:36 +01:00
Linus Torvalds
92371935fc Parse EON Steel notification and state changes
The EON Steel notifications and states match the libdivecomputer ones
very badly, but this tries to make sense of the ones that match.  And
puts the infrastructure in to do others in the future.

Signed-off-by: Linus Torvalds <torvalds@linux-fouindation.org>
2015-01-08 08:49:36 +01:00
Linus Torvalds
7a7418421c Add EON Steel gas change event parsing
The really sad part is that the EON Steel handles gas change events
correctly, by actually saying which cylinder it switches to.  But the
libdivecomputer interfaces are broken, and only contain the gas *mix*
you switch to, which is ambiguous since you could have the same mix in
multiple cylinders.

Maybe we could put the one-based cylinder index into the "flags" field?
With zero meaning "unknown". That would be a straightforward extension.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-01-08 08:49:36 +01:00
Jef Driesen
87e6940572 Add support for the DiveSystem iDive and Orca. 2014-12-29 10:09:34 +01:00
Jef Driesen
f941af8d25 Merge branch 'ostc3-firmware' 2014-12-21 15:48:02 +01:00
Jef Driesen
396b867119 Reserve one byte extra for the null character.
The OSTC3 can display a status message of up to 16 characters large.
Since this does not include the terminating null character, the buffer
needs to be one byte larger.
2014-12-21 15:02:48 +01:00
Jef Driesen
e2589c0756 Replace the code for handling line endings.
The new implementation is similar to the already existing code for
reading Intel HEX files. It can handle arbitrary line endings, and not
just CRLF or LF.
2014-12-21 15:02:08 +01:00
Anton Lundin
2d4f76ab51 Simplify state switching and checking for OSTC3
This simplifies the code to check and handle state switching for the
OSTC3.

Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Anton Lundin
7c447c5c16 Remove unused imports
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Anton Lundin
57701ba0b0 Add Anton to copyright notice.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Anton Lundin
c6486444d3 Teach examples/ostc-fwupdate about OSTC3
This teaches the example firmware upgrader about how to upgrade the
OSTC3's.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Anton Lundin
02d8c0f04a Firmware upgrade for OSTC3
This connects the bits and implements firmware upgrade for the OSTC3.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Anton Lundin
2733a9dc53 Add code to send upgrade firmware command to OSTC3
This function triggers a reboot into the bootloader which flashes the
new firmware to Prom.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
543ddca8a2 Add code to write rom of the OSTC3
This is how you transfer a new firmware to the OSTC3.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
6322e96268 Add function to read the rom from the OSTC3
This is necessary to verify that the memory written got transfered
correctly.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
5c71ff34c4 Add a function to erase the memory of the OSTC3
This is the fist step in the firmware upgrade process.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
08dda98c29 Add utility functions to convert uints to bytes
Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
1d8337c570 Add a helper to put the OSTC3 into servicemode
This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
d8f11810e1 Lift the OSTC3 INIT out of open
This lifts the OSTC3 INIT command out from the open function and does
that separately. This is refactoring to be able to enter service mode so
we can access service mode commands.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:00:02 +01:00
Anton Lundin
b1c12b597b Add code to read and decrypt OSTC3 firmware files
This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 14:52:12 +01:00
Anton Lundin
954cae1a0e Workaround msvc lack of a stdint.h
Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 14:52:12 +01:00
Anton Lundin
5820ac01e3 Port TinyAES-128 to be thread safe.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 14:52:12 +01:00