summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--daemon/CMakeLists.txt2
-rw-r--r--daemon/sensorPlugins/barometerSensor.cpp4
-rw-r--r--daemon/sensorPlugins/barometerSensor.h3
3 files changed, 8 insertions, 1 deletions
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 9093b33..a11b7cb 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -13,7 +13,7 @@ add_executable(sensorlogd
)
set_target_properties(sensorlogd PROPERTIES AUTOMOC ON)
#add_compile_definitions(Q_DECLARE_PRIVATE_SUPPORTS_UNIQUE_PTR=${Q_DECLARE_PRIVATE_SUPPORTS_UNIQUE_PTR})
-target_link_libraries(sensorlogd PRIVATE Qt5::Core Qt5::DBus Qt5::Qml Qt5::Sensors)
+target_link_libraries(sensorlogd PRIVATE Qt5::Core Qt5::DBus Qt5::Qml Qt5::Sensors Mlite5::Mlite5)
install(TARGETS sensorlogd DESTINATION bin)
install(FILES systemd/asteroid-sensorlogd.service
DESTINATION /usr/lib/systemd/user)
diff --git a/daemon/sensorPlugins/barometerSensor.cpp b/daemon/sensorPlugins/barometerSensor.cpp
index 137ccd3..46f7e11 100644
--- a/daemon/sensorPlugins/barometerSensor.cpp
+++ b/daemon/sensorPlugins/barometerSensor.cpp
@@ -14,6 +14,7 @@
#include <QtSensors/QPressureSensor>
#include <QDebug>
#include <QString>
+#include <MGConfItem>
#include "../logger.h"
#include "../../common.h"
@@ -28,8 +29,10 @@ BarometerSensorPlugin::BarometerSensorPlugin(QObject *parent, int initInterval)
connect(barometerSensor,SIGNAL(readingChanged()),this,SLOT(finishRecording()));
setupFilePath(sensorPathPrefix);
+ setupFilePath(sensorPathPrefixCompensated);
qDebug() << "barometer sensor is enabled. interval is (ms) " << interval;
+ m_barometerOffsetGconf = new MGConfItem("/org/asteroidos/sensors/barometer-offset");
recordIntervalTimer = new QTimer(this);
connect(recordIntervalTimer,SIGNAL(timeout()),this,SLOT(triggerRecording()));
recordIntervalTimer->setSingleShot(true);
@@ -63,5 +66,6 @@ void BarometerSensorPlugin::finishRecording() {
return;
}
fileAddRecord(sensorPathPrefix,QString::number(pressure));
+ fileAddRecord(sensorPathPrefixCompensated,QString::number(pressure - m_barometerOffsetGconf->value(0).toInt()));
barometerSensor->stop();
}
diff --git a/daemon/sensorPlugins/barometerSensor.h b/daemon/sensorPlugins/barometerSensor.h
index 0ec9fb2..0420aa8 100644
--- a/daemon/sensorPlugins/barometerSensor.h
+++ b/daemon/sensorPlugins/barometerSensor.h
@@ -16,6 +16,7 @@
#include <QDBusInterface>
#include <QTimer>
#include <QSettings>
+#include <MGConfItem>
#include <QtSensors/QPressureSensor>
@@ -39,8 +40,10 @@ private:
QTimer *recordIntervalTimer;
QPressureSensor *barometerSensor;
QSettings *m_settings;
+ MGConfItem *m_barometerOffsetGconf;
const QString sensorPathPrefix = "barometer-raw";
+ const QString sensorPathPrefixCompensated = "barometer-compensated";
};
#endif // BAROMETERSENSOR_H