summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt1
-rw-r--r--daemon/CMakeLists.txt2
-rw-r--r--daemon/sensorPlugins/barometerSensor.cpp4
-rw-r--r--daemon/sensorPlugins/barometerSensor.h3
4 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c04ce73..24aeca0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ include(AsteroidCMakeSettings)
include(AsteroidCMakeSettings)
find_package(Qt5 COMPONENTS Core DBus Qml Sensors REQUIRED)
+find_package(Mlite5 MODULE REQUIRED)
add_subdirectory(daemon)
add_subdirectory(qmlplugin)
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