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.
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.
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.
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.
Merge upstream libdivecomputer changes from Jef Driesen.
The most notable one is how libdivecomputer no longer sends the
GASCHANGE events, but uses DC_SAMPLE_GASMIX instead.
We still turn it into a SAMPLE_EVENT_GASCHANGE2 event internally in
subsurface, since we want all the normal event handling to trigger.
* 'master' of git://git.libdivecomputer.org/libdivecomputer: (21 commits)
Document the date/time functions
Document the public api with man pages
Add support for the Cressi Drake
Detect overwritten dive profiles
Ignore tank pressure if no sensor is attached
Add support for the tank field
Add support for the salinity field
Use the sample interval from the settings
Update the Aqualung i750TC parser
Toggle the DTR line during setup
Implement the read function
Add doxygen documentation to the build system
Add support for the Aqualung i750TC
Fix the Windows version resource build
Force the dive mode to gauge
Add support for the dive mode
Report the initial gas mix on the first sample
Remove the deprecated gas change events
Add support for the Hollis DG02.
Add support for the Oceanic F10.
...
The code was just if instead of else if by accident.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
OSTC4 stores firmware in another format than OSTC3's.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This way we actually trace print the written buffer, even if the caller
doesn't care about how much data he/she actually wrote.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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.
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.
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.
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.
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.
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.
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.
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.
Merge upstream version 0.5.0.
Some small updates from Jef Driesen since the last sync, but let's sync
with the real 0.5.0 release.
* tag 'v0.5.0' of git://git.libdivecomputer.org/libdivecomputer:
Release version 0.5.0.
Include the public header in the implementation file.
Add explicit casts for the msvc C++ compiler.
Add some workarounds for the msvc compiler.
Update the msvc project file.
Add missing header files to the Makefiles.
Add support for the Subgear XP-Air
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).
Merge with Jef Driesen's upstream.
Jef has updated his branch with about half of the EON Steel fixes, but
still refuses to admit that the string model is much superior to his
crazy "random numbers that can't actually describe anything properly"
model, and left out all those parts.
But Jef also made a generic HID layer thing that cleans things up (but
causes a spurious warning about a failed usb hid read due to the "clean
out old data" code that *expects& the failure), and fixed his version of
the HW Frog firmware, so this cleans up that issue.
We also now have that gas mix parsing fix for the Aladin Tec 2G properly
merged, so that our cherry-pick won't cause merge issues later.
* 'master' of git://git.libdivecomputer.org/libdivecomputer:
Fix the firmware version for the HW Frog.
Use the new USB HID backend for the Eon Steel.
Add a dummy backend for systems without USB HID support.
Use the hidapi library on Mac OS X.
Add a new USB HID communication backend.
Add a configure option to build without libusb.
Restore the sample events.
Suunto EON Steel: initialize the tank 'gasmix' index
Suunto EON Steel: do the proper enum lookup for a few more cases
Suunto EON Steel: fix the event begin/end flag
Suunto EON Steel: split out gas info parsing
EON Steel: look up enum descriptor strings
EON Steel: pass in the type descriptor to samples that need it
EON Steel: mark tank cache initialized when filling it in
EON Steel: fix uninitialized field cache entries
Initial Suunto EON Steel CCR support
Suunto EON Steel: add descriptor debugging output
Add tank size reporting for Suunto EON Steel
Fix the gas mix parsing for the Aladin Tec 2G.
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.
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.
This removes the additional entry for AQUAI300, as it was done in "Fix
the memory layout for the Aqualung i300." (1e22760f9102ac).
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>