Edit sleep mode settings to be autostart aware

Fixes #696
This commit is contained in:
Ben V. Brown
2020-12-31 10:11:20 +11:00
parent 7f81fbbe7a
commit 29863ebf6c
2 changed files with 27 additions and 28 deletions

View File

@@ -27,7 +27,7 @@ void detectAccelerometerVersion() {
#ifdef ACCEL_MMA
if (MMA8652FC::detect()) {
PCBVersion = 1;
if(!MMA8652FC::initalize()) {
if (!MMA8652FC::initalize()) {
PCBVersion = 99;
}
} else
@@ -36,7 +36,7 @@ void detectAccelerometerVersion() {
if (LIS2DH12::detect()) {
PCBVersion = 2;
// Setup the ST Accelerometer
if(!LIS2DH12::initalize()) {
if (!LIS2DH12::initalize()) {
PCBVersion = 99;
}
} else
@@ -58,7 +58,7 @@ void detectAccelerometerVersion() {
}
}
inline void readAccelerometer(int16_t& tx, int16_t& ty, int16_t& tz, Orientation &rotation) {
inline void readAccelerometer(int16_t &tx, int16_t &ty, int16_t &tz, Orientation &rotation) {
#ifdef ACCEL_LIS
if (PCBVersion == 2) {
LIS2DH12::getAxisReadings(tx, ty, tz);
@@ -82,12 +82,13 @@ inline void readAccelerometer(int16_t& tx, int16_t& ty, int16_t& tz, Orientation
}
}
void startMOVTask(void const *argument __unused) {
osDelay(10);//Make oled init happen first
osDelay(1); //Make oled init happen first
postRToSInit();
OLED::setRotation(systemSettings.OrientationMode & 1);
detectAccelerometerVersion();
lastMovementTime = 0;
if ((systemSettings.autoStartMode == 2 || systemSettings.autoStartMode == 3))
osDelay(2000);
osDelay(2 * TICKS_SECOND);
lastMovementTime = 0;
int16_t datax[MOVFilter] = { 0 };