Hotfix: BMA Accel wedges I2C if probed too fast after boot
Only an issue on Pinecil as it boots much faster than Miniware units.
This commit is contained in:
@@ -749,7 +749,7 @@ void showWarnings() {
|
||||
// In this case though, we dont want to nag the user _too_ much
|
||||
// So only show first 2 times
|
||||
while (DetectedAccelerometerVersion == ACCELEROMETERS_SCANNING) {
|
||||
osDelay(1);
|
||||
osDelay(5);
|
||||
}
|
||||
// Display alert if accelerometer is not detected
|
||||
if (DetectedAccelerometerVersion == NO_DETECTED_ACCELEROMETER) {
|
||||
@@ -800,7 +800,6 @@ void startGUITask(void const *argument __unused) {
|
||||
ButtonState buttons = getButtonState();
|
||||
if (buttons)
|
||||
ticks = xTaskGetTickCount(); // make timeout now so we will exit
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "LIS2DH12.hpp"
|
||||
#include "MMA8652FC.hpp"
|
||||
#include "MSA301.h"
|
||||
#include "Model_Config.h"
|
||||
#include "QC3.h"
|
||||
#include "SC7A20.hpp"
|
||||
#include "Settings.h"
|
||||
@@ -25,8 +26,9 @@
|
||||
#define MOVFilter 8
|
||||
uint8_t accelInit = 0;
|
||||
TickType_t lastMovementTime = 0;
|
||||
void detectAccelerometerVersion() {
|
||||
DetectedAccelerometerVersion = 99;
|
||||
|
||||
void detectAccelerometerVersion() {
|
||||
DetectedAccelerometerVersion = ACCELEROMETERS_SCANNING;
|
||||
#ifdef ACCEL_MMA
|
||||
if (MMA8652FC::detect()) {
|
||||
if (MMA8652FC::initalize()) {
|
||||
@@ -44,7 +46,7 @@ void detectAccelerometerVersion() {
|
||||
#endif
|
||||
#ifdef ACCEL_BMA
|
||||
if (BMA223::detect()) {
|
||||
// Setup the ST Accelerometer
|
||||
// Setup the BMA223 Accelerometer
|
||||
if (BMA223::initalize()) {
|
||||
DetectedAccelerometerVersion = 3;
|
||||
}
|
||||
@@ -68,7 +70,8 @@ void detectAccelerometerVersion() {
|
||||
#endif
|
||||
{
|
||||
// disable imu sensitivity
|
||||
systemSettings.sensitivity = 0;
|
||||
systemSettings.sensitivity = 0;
|
||||
DetectedAccelerometerVersion = NO_DETECTED_ACCELEROMETER;
|
||||
}
|
||||
}
|
||||
inline void readAccelerometer(int16_t &tx, int16_t &ty, int16_t &tz, Orientation &rotation) {
|
||||
@@ -107,6 +110,7 @@ inline void readAccelerometer(int16_t &tx, int16_t &ty, int16_t &tz, Orientation
|
||||
}
|
||||
}
|
||||
void startMOVTask(void const *argument __unused) {
|
||||
osDelay(TICKS_100MS / 5);// This is here as the BMA doesnt start up instantly and can wedge the I2C bus if probed too fast after boot
|
||||
detectAccelerometerVersion();
|
||||
osDelay(TICKS_100MS / 2); // wait ~50ms for setup of accel to finalise
|
||||
lastMovementTime = 0;
|
||||
|
||||
Reference in New Issue
Block a user