performance enhancements

memory enhancements
prevent starting sensors more than once
fix for wifi lag issues
map scaling for huge buildings
This commit is contained in:
2016-10-01 10:21:15 +02:00
parent 833327bafd
commit 44f9b6ac80
16 changed files with 197 additions and 26 deletions

View File

@@ -23,6 +23,8 @@ private:
;
}
bool started = false;
public:
/** singleton access */
@@ -33,26 +35,30 @@ public:
void start() override {
if (started) {return;}
started = true;
auto onSensorData = [&] () {
AccelerometerData data(acc.reading()->x(), acc.reading()->y(), acc.reading()->z());
informListeners(data);
};
// accelerometer is usually verry fast -> limit the maximum data-rate to 200 Hz (5ms)
acc.setDataRate(200);
acc.connect(&acc, &QAccelerometer::readingChanged, onSensorData);
acc.start();
}
bool isRunning() const override {
return acc.isActive();
return started;
}
void stop() override {
throw "TODO";
}
};
#endif // ANDROID