summaryrefslogtreecommitdiff
path: root/daemon/sensorPlugins
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--daemon/sensorPlugins/barometerSensor.cpp4
-rw-r--r--daemon/sensorPlugins/barometerSensor.h3
2 files changed, 7 insertions, 0 deletions
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