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.
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.
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>
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.
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>
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.
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.
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.
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>
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>
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>
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.
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.
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.
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.
The fingerprint is used unconditionally, regardless of whether it's
explicitly set by the application or not. Therefore it needs to be
initialized properly.
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.
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.
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.
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.
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.
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.