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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user