|
|
@@ -237,14 +237,11 @@ void Icm20948::Read(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * @brief Interrupt status regiter - INT_STATUS_1
|
|
|
- * @return 1 – Sensor Register Raw Data, from all sensors, is updated and ready to be read.
|
|
|
- */
|
|
|
+
|
|
|
uint8_t Icm20948::GetDataStatus(void)
|
|
|
{
|
|
|
- uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_0, B0_INT_STATUS_1);
|
|
|
- return new_val & 0x01;
|
|
|
+ // same register for ACC and GYRO sensor
|
|
|
+ return this->accSensor->GetDataStatus();
|
|
|
}
|
|
|
|
|
|
/// ---------------------- MAGNETOEMTER -----------------------------------
|
|
|
@@ -310,6 +307,15 @@ Sensor::Sensor(SpiManager *spi, int8_t activeDevice){
|
|
|
_scaleFactor = 1.0f;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @brief Interrupt status regiter - INT_STATUS_1
|
|
|
+ * @return 1 – Sensor Register Raw Data, from all sensors, is updated and ready to be read.
|
|
|
+ */
|
|
|
+uint8_t Sensor::GetDataStatus(void)
|
|
|
+{
|
|
|
+ uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_0, B0_INT_STATUS_1);
|
|
|
+ return new_val & 0x01;
|
|
|
+}
|
|
|
|
|
|
SensorGyro::SensorGyro(SpiManager *spi, int8_t activeDevice):Sensor(spi, activeDevice){
|
|
|
|
|
|
@@ -665,7 +671,7 @@ void SensorGyro::Calibrate(void)
|
|
|
|
|
|
for(int i = 0; i < 100; i++)
|
|
|
{
|
|
|
-// this->gyroSensor->Read(&temp);
|
|
|
+ while(this->GetDataStatus() == 0);
|
|
|
this->Read(&temp);
|
|
|
gyro_bias[0] += temp.x;
|
|
|
gyro_bias[1] += temp.y;
|
|
|
@@ -703,6 +709,7 @@ void SensorAccel::Calibrate()
|
|
|
|
|
|
for(int i = 0; i < 100; i++)
|
|
|
{
|
|
|
+ while(this->GetDataStatus() == 0);
|
|
|
this->Read(&temp);
|
|
|
accel_bias[0] += temp.x;
|
|
|
accel_bias[1] += temp.y;
|