diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2014-06-05 12:41:23 +0300 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2014-08-09 12:01:56 -0300 |
commit | ee2403d63c282cbf7ef6b155013ae2cc42278ee7 (patch) | |
tree | a485166cf57f24f39dbde39b41071c644327db89 | |
parent | a08d239af598632eec5a8bb951aeda4cfc441fc8 (diff) | |
download | subsurface-ee2403d63c282cbf7ef6b155013ae2cc42278ee7.tar.gz |
Improve writing of date and time to dive computer
Improves writing of date and time to the dive computer. This
has been tested using the Heinrichs Weikamp OSTC-3.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index ae71ea627..2d7008b81 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -125,8 +125,7 @@ void WriteSettingsThread::run() result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data()); } } - if ( dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3 && m_settingName == "DateTime" ) { - supported = true; + if (m_settingName == "DateAndTime") { QDateTime timeToSet = m_settingValue.toDateTime(); dc_datetime_t time; time.year = timeToSet.date().year(); @@ -135,7 +134,21 @@ void WriteSettingsThread::run() time.hour = timeToSet.time().hour(); time.minute = timeToSet.time().minute(); time.second = timeToSet.time().second(); - result = hw_ostc_device_clock(data->device, &time); //Toto fix error here + + switch (dc_device_get_type(data->device)) { + case DC_FAMILY_HW_OSTC3: + supported = true; + result = hw_ostc3_device_clock(data->device, &time); + break; + case DC_FAMILY_HW_OSTC: + supported = true; + result = hw_ostc_device_clock(data->device, &time); + break; + case DC_FAMILY_HW_FROG: + supported = true; + result = hw_frog_device_clock(data->device, &time); + break; + } } if (result != DC_STATUS_SUCCESS) { qDebug() << result; |