Skip to content

Commit

Permalink
Some build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel committed Mar 8, 2024
1 parent 0a89ec1 commit 33580ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/network/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,11 @@ void Connection::update() {
std::vector<Sensor *> & sensors = sensorManager.getSensors();
if(sensorId < sensors.size()) {
Sensor * sensor = sensors[sensorId];
sensor->setFlag(flagId, newState);
}
}
sendAcknowledgeConfigChange(sensorId, flagId);
break;
}
}

Expand Down
18 changes: 11 additions & 7 deletions src/sensors/bno080sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void BNO080Sensor::motionSetup()
break;
default:
// Ignore lack of config for BNO, byt default use from FW build
break;
}

if(!m_magEnabled) {
Expand Down Expand Up @@ -132,7 +133,7 @@ void BNO080Sensor::motionLoop()

setFusedRotationReady();
// Leave new quaternion if context open, it's closed later

}
} else {

if (imu.hasNewQuat()) // New quaternion if context
Expand All @@ -142,6 +143,7 @@ void BNO080Sensor::motionLoop()

setFusedRotationReady();
// Leave new quaternion if context open, it's closed later
} // Closing new quaternion if context
}

// Continuation of the new quaternion if context, used for both 6 and 9 axis
Expand All @@ -152,9 +154,9 @@ void BNO080Sensor::motionLoop()
setAccelerationReady();
}
#endif // SEND_ACCELERATION
} // Closing new quaternion if context

if(BNO_USE_MAGNETOMETER_CORRECTION && !m_magEnabled) {

#if BNO_USE_MAGNETOMETER_CORRECTION
if(!m_magEnabled) {
if (imu.hasNewMagQuat())
{
imu.getMagQuat(magQuaternion.x, magQuaternion.y, magQuaternion.z, magQuaternion.w, magneticAccuracyEstimate, magCalibrationAccuracy);
Expand All @@ -169,6 +171,7 @@ void BNO080Sensor::motionLoop()
newMagData = true;
}
}
#endif

if (imu.getTapDetected())
{
Expand Down Expand Up @@ -203,7 +206,8 @@ void BNO080Sensor::motionLoop()
}
}

SensorStatus BNO080Sensor::getSensorState() {
SensorStatus BNO080Sensor::getSensorState()
{
return lastReset > 0 ? SensorStatus::SENSOR_ERROR : isWorking() ? SensorStatus::SENSOR_OK : SensorStatus::SENSOR_OFFLINE;
}

Expand Down Expand Up @@ -247,11 +251,11 @@ void BNO080Sensor::sendData()
}
}

void BNO080Sensor::setFlag(uint16_t flagId, bool state) {
void BNO080Sensor::setFlag(uint16_t flagId, bool state)
{
if(flagId == FLAG_SENSOR_BNO0XX_MAG_ENABLED) {
m_Calibration.magEnabled = state;
m_magEnabled = state;
configuration.setCalibration(sensorId, m_Calibration);
if(state) {
if ((sensorType == IMU_BNO085 || sensorType == IMU_BNO086) && BNO_USE_ARVR_STABILIZATION) {
imu.enableARVRStabilizedRotationVector(10);
Expand Down

0 comments on commit 33580ef

Please sign in to comment.