mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Port writing of date and time to new classes
After splitting dive computer configuration classes, the date/time setting had not been ported. This adds the same to the classes. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
parent
20eb62a98a
commit
3534e29ae2
5 changed files with 81 additions and 44 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "configuredivecomputerthreads.h"
|
||||
#include "libdivecomputer/hw.h"
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data)
|
||||
|
@ -95,6 +96,20 @@ void WriteSettingsThread::run()
|
|||
hw_ostc3_device_config_write(m_data->device, 0x32, data, sizeof(data));
|
||||
data[0] = m_deviceDetails->dateFormat();
|
||||
hw_ostc3_device_config_write(m_data->device, 0x33, data, sizeof(data));
|
||||
|
||||
//sync date and time
|
||||
if (m_deviceDetails->syncTime()) {
|
||||
QDateTime timeToSet = QDateTime::currentDateTime();
|
||||
dc_datetime_t time;
|
||||
time.year = timeToSet.date().year();
|
||||
time.month = timeToSet.date().month();
|
||||
time.day = timeToSet.date().day();
|
||||
time.hour = timeToSet.time().hour();
|
||||
time.minute = timeToSet.time().minute();
|
||||
time.second = timeToSet.time().second();
|
||||
hw_ostc3_device_clock(m_data->device, &time);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue