From ee2403d63c282cbf7ef6b155013ae2cc42278ee7 Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" Date: Thu, 5 Jun 2014 12:41:23 +0300 Subject: 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 Signed-off-by: Thiago Macieira --- qt-ui/configuredivecomputer.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'qt-ui') 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; -- cgit v1.2.3-70-g09d2