1
0
forked from me/IronOS

Reduce code size for accelerometer support (#288)

* Reduce the LIS2DH12 driver's code size.
* Reduce the MMA8652FC driver's code size.
* Make orientation detection smaller.


* Inlined C++ class constructor.
* De-unroll I2C register writes.
* Removed unused setSensitivity method.
This commit is contained in:
Alessandro Gatti
2018-05-10 02:02:29 +02:00
committed by Ben V. Brown
parent 4718efe79b
commit 215fe8e9e8
6 changed files with 76 additions and 75 deletions

View File

@@ -881,7 +881,7 @@ void startMOVTask(void const *argument) {
#if ACCELDEBUG
uint32_t max = 0;
#endif
uint8_t rotation = 0;
Orientation rotation = ORIENTATION_FLAT;
for (;;) {
int32_t threshold = 1500 + (9 * 200);
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
@@ -894,8 +894,8 @@ void startMOVTask(void const *argument) {
rotation = accel.getOrientation();
}
if (systemSettings.OrientationMode == 2) {
if (rotation != 0) {
lcd.setRotation(rotation == 2); // link the data through
if (rotation != ORIENTATION_FLAT) {
lcd.setRotation(rotation == ORIENTATION_LEFT_HAND); // link the data through
}
}
datax[currentPointer] = (int32_t) tx;