The old OSTC settings debug code was a bit ugly.
This cleans that up and contains all the ugly-ness behind the
DEBUG_OSTC ifdef.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This debug code was accidentally added in b2f4896f ("Whitespace cleanup")
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the writing of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the writing of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the reading of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the reading of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the writing of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This lifts the reading of settings out of the run() method and
introduces better error handling when libdivecomputer returns a
error.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This enables the dormant OSTC3/OSTC Sport firmware update code, now when
the hw_ostc3_device_fwupdate call is available in libdivecomputer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Stinger stores the alarm time in seconds, instead of minutes as the
Vyper does it. This corrects for that.
Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a bit ugly fix to make sure the right error message reaches the
user in case of being unable to open the device.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The hw_ostc_device_eeprom_read / hw_ostc_device_eeprom_write functions
have bin in libdivecomputer since v0.1.0, so there was an error when the
read settings part ended up behind ifdef's.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fixes a warning. The function is only used if
DC_VERSION_CHECK(0, 5, 0) is defined.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This changes the OSTC3 READ_SETTING/WRITE_SETTING macros into something
that can have a ; in the end which makes some editors auto-indent it better.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds code that writes configuration data to the OSTC. As we don't
look at all the values in the OSTC config blocks, we read the current
blocks and only change the values we can change.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code is to debug the rest of the existing CF's, so we can look at
the rest of the values.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds code to decode the custom functions data.
We only decode the relevant CF's. The relevant ones are chosen by which
ones have corresponding settings in the OSTC3.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds code to decode the configuration blocks from the OSTC.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds debug code to simulate the read and write to OSTC memory
dumps.
The OSTC configuration happens via writing whole 512 byte blocks to the
memory and this code is useful when debugging that process
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This cleans up some styling and syntax in the Configure Dive Computer
code path.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reports back a error to the user if the firmware update failed.
We should re-wire this to have a log-function that gets called from
libdivecomputer via the context to get an actual error message.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
hw_ostc_device_fwupdate was introduced after 0.4.2 so ifdef it to
libdivecomputer >= 0.5.0. The scope of users interested in this feature
probably isn't big enough to justify a bump of our dependencies to a
unreleased version of libdivecomputer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The OSTC3 stores the pressure sensor offset as a signed 8-bit integer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There was a missing break after writing the settings to the OSTC3. It
caused us to fall down into the default case and saying that the
operation was unsupported.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The OSTC3 settings code read the data from the computer into spData, but
set the data into the devicedetails object from dilData.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds missing code to read and write the desaturation factor to and
from OSTC3's.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code adds some crude checks to verify that the device is a
supported one before we actually read/write from it. This is to
white/black-list devices so we don't write or read memory that we don't
know anything about.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements the reading and writing of the configuration varables
from the Suunto Vyper family devices.
Everything here is implemented based on the excellent information on:
http://www.sarnau.info/papers:suunto_vyper
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The setpoint values was never stored in the deviceinfo object.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This change changes the way we present the OSTC 3 firmware version to a
correct value, showing the major and minor version number.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
The OSTC3 functions we need were introduced in 0.5.0 (more specifically,
in commit 56e2dec7266e71e725604a4a8bff5e61f3d62259).
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Changes the classes in configuredivecomputerthreads.cpp to use
macros to hold the setting hex codes.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
This patch implements the first step towards OSTC 3 firmware update.
Its not much, just file selection, but I will build up on it from there.
Implements a thread to initiate firmware updates. Currently, this is
for the OSTC 3.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Implements support for reading, writing and backup/restore of set point
settings for the OSTC 3.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Implements reading, writing and backup/restore of OSTC 3 Dil Values
(setting 0x15 to 0x19)
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>