mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 17:55:30 +03:00
OSD G-force Fix unit test; use sqrtf
This commit is contained in:
parent
51e57199fb
commit
7df8075fa3
2 changed files with 6 additions and 2 deletions
|
@ -696,8 +696,8 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
const float a = accAverage[axis];
|
const float a = accAverage[axis];
|
||||||
osdGForce += a * a;
|
osdGForce += a * a;
|
||||||
}
|
}
|
||||||
osdGForce = pow_approx(osdGForce, 0.5) / acc.dev.acc_1G;
|
osdGForce = sqrtf(osdGForce) / acc.dev.acc_1G;
|
||||||
tfp_sprintf(buff, "%01d.%01d%c", (uint8_t)osdGForce, (uint8_t)(osdGForce * 10) % 10, "G");
|
tfp_sprintf(buff, "%01d.%01d%c", (int)osdGForce, (int)(osdGForce * 10) % 10, "G");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ extern "C" {
|
||||||
#include "io/gps.h"
|
#include "io/gps.h"
|
||||||
#include "io/osd.h"
|
#include "io/osd.h"
|
||||||
|
|
||||||
|
#include "sensors/acceleration.h"
|
||||||
#include "sensors/battery.h"
|
#include "sensors/battery.h"
|
||||||
|
|
||||||
#include "rx/rx.h"
|
#include "rx/rx.h"
|
||||||
|
@ -69,6 +70,9 @@ extern "C" {
|
||||||
int32_t GPS_coord[2];
|
int32_t GPS_coord[2];
|
||||||
gpsSolutionData_t gpsSol;
|
gpsSolutionData_t gpsSol;
|
||||||
|
|
||||||
|
acc_t acc;
|
||||||
|
float accAverage[XYZ_AXIS_COUNT];
|
||||||
|
|
||||||
PG_REGISTER(batteryConfig_t, batteryConfig, PG_BATTERY_CONFIG, 0);
|
PG_REGISTER(batteryConfig_t, batteryConfig, PG_BATTERY_CONFIG, 0);
|
||||||
PG_REGISTER(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 0);
|
PG_REGISTER(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 0);
|
||||||
PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue