summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-07 21:56:44 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-09 12:01:56 -0300
commit2432350064c6a9109501b3df21f56a9fe41aa686 (patch)
treeb7560ecfee5b98ca084dadad121af2fac71dcc9f /qt-ui/configuredivecomputer.cpp
parenta7a74ae9a630dba8ba29afb3fece6c9f5bf3639d (diff)
downloadsubsurface-2432350064c6a9109501b3df21f56a9fe41aa686.tar.gz
Add brightness setting
Adds a setting to control the device's brightness. Currently I have only the OSTC 3. Will add more afterwards. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui/configuredivecomputer.cpp')
-rw-r--r--qt-ui/configuredivecomputer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp
index f591efffa..8cc3a6953 100644
--- a/qt-ui/configuredivecomputer.cpp
+++ b/qt-ui/configuredivecomputer.cpp
@@ -34,6 +34,11 @@ void ConfigureDiveComputer::setDeviceDateAndTime(device_data_t *data, QDateTime
writeSettingToDevice(data, "DateAndTime", dateAndTime);
}
+void ConfigureDiveComputer::setDeviceBrightness(device_data_t *data, int brighnessLevel)
+{
+ writeSettingToDevice(data, "Brightness", brighnessLevel);
+}
+
void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState)
{
currentState = newState;
@@ -151,6 +156,17 @@ void WriteSettingsThread::run()
break;
}
}
+ if (m_settingName == "Brightness") {
+ switch (dc_device_get_type(data->device)) {
+ case DC_FAMILY_HW_OSTC3:
+ qDebug() << "Brightness";
+ supported = true;
+ unsigned char packet[1] = { m_settingValue.toInt() };
+ result = hw_ostc3_device_config_write(data->device, 0x2D, packet, sizeof (packet));
+ break;
+ }
+ }
+ qDebug() << result;
if (result != DC_STATUS_SUCCESS) {
qDebug() << result;
lastError = tr("An error occurred while sending data to the dive computer.");