mirror of
https://github.com/SlimeVR/SlimeVR-Tracker-ESP.git
synced 2026-04-06 02:01:57 +02:00
Report IMU errors (#288)
* Make not working sensors report error by default * Set IMU error flag if any sensor reported error
This commit is contained in:
committed by
GitHub
parent
63d25dafc6
commit
ffebf5fbb1
@@ -40,6 +40,10 @@ namespace SlimeVR
|
||||
void motionLoop() override final{};
|
||||
void sendData() override final{};
|
||||
void startCalibration(int calibrationType) override final{};
|
||||
SensorStatus getSensorState() override final
|
||||
{
|
||||
return SensorStatus::SENSOR_OFFLINE;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,13 +187,20 @@ namespace SlimeVR
|
||||
void SensorManager::update()
|
||||
{
|
||||
// Gather IMU data
|
||||
bool allIMUGood = true;
|
||||
for (auto sensor : m_Sensors) {
|
||||
if (sensor->isWorking()) {
|
||||
swapI2C(sensor->sclPin, sensor->sdaPin);
|
||||
sensor->motionLoop();
|
||||
}
|
||||
if (sensor->getSensorState() == SensorStatus::SENSOR_ERROR)
|
||||
{
|
||||
allIMUGood = false;
|
||||
}
|
||||
}
|
||||
|
||||
statusManager.setStatus(SlimeVR::Status::IMU_ERROR, !allIMUGood);
|
||||
|
||||
if (!networkConnection.isConnected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "calibration.h"
|
||||
|
||||
SensorStatus Sensor::getSensorState() {
|
||||
return isWorking() ? SensorStatus::SENSOR_OK : SensorStatus::SENSOR_OFFLINE;
|
||||
return isWorking() ? SensorStatus::SENSOR_OK : SensorStatus::SENSOR_ERROR;
|
||||
}
|
||||
|
||||
void Sensor::setAccelerationReady() {
|
||||
|
||||
Reference in New Issue
Block a user