Merge pull request #6775 from kmitchel/fix_osd_stat_max_g_force

Relocate G-force calculation.
This commit is contained in:
borisbstyle 2018-09-17 08:54:41 +02:00 committed by GitHub
commit 27cbf0515d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 10 deletions

View File

@ -738,16 +738,8 @@ static bool osdDrawSingleElement(uint8_t item)
}
case OSD_G_FORCE:
{
osdGForce = 0.0f;
for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
const float a = accAverage[axis];
osdGForce += a * a;
}
osdGForce = sqrtf(osdGForce) * acc.dev.acc_1G_rec;
tfp_sprintf(buff, "%01d.%01dG", (int)osdGForce, (int)(osdGForce * 10) % 10);
break;
}
tfp_sprintf(buff, "%01d.%01dG", (int)osdGForce, (int)(osdGForce * 10) % 10);
break;
case OSD_ROLL_PIDS:
osdFormatPID(buff, "ROL", &currentPidProfile->pid[PID_ROLL]);
@ -1050,6 +1042,12 @@ static void osdDrawElements(void)
}
if (sensors(SENSOR_ACC)) {
osdGForce = 0.0f;
for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
const float a = accAverage[axis];
osdGForce += a * a;
}
osdGForce = sqrtf(osdGForce) * acc.dev.acc_1G_rec;
osdDrawSingleElement(OSD_ARTIFICIAL_HORIZON);
osdDrawSingleElement(OSD_G_FORCE);
}