Merge pull request #9583 from etracer65/gyro_temperature_read_rate

Reduce gyro temperature read rate from 250hz to every 3 seconds
This commit is contained in:
Michael Keller 2020-03-15 14:14:42 +13:00 committed by GitHub
commit 6ed4c0fbee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -1157,12 +1157,16 @@ static FAST_CODE_NOINLINE void subTaskPidSubprocesses(timeUs_t currentTimeUs)
}
#ifdef USE_TELEMETRY
#define GYRO_TEMP_READ_DELAY_US 3e6 // Only read the gyro temp every 3 seconds
void subTaskTelemetryPollSensors(timeUs_t currentTimeUs)
{
UNUSED(currentTimeUs);
static timeUs_t lastGyroTempTimeUs = 0;
// Read out gyro temperature if used for telemmetry
gyroReadTemperature();
if (cmpTimeUs(currentTimeUs, lastGyroTempTimeUs) >= GYRO_TEMP_READ_DELAY_US) {
// Read out gyro temperature if used for telemmetry
gyroReadTemperature();
lastGyroTempTimeUs = currentTimeUs;
}
}
#endif