mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Added G-Force to the OSD
This commit is contained in:
parent
e260c37be3
commit
e2eca1b762
7 changed files with 20 additions and 1 deletions
|
@ -86,6 +86,7 @@
|
|||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "sensors/acceleration.h"
|
||||
#include "sensors/adcinternal.h"
|
||||
#include "sensors/barometer.h"
|
||||
#include "sensors/battery.h"
|
||||
|
@ -687,6 +688,18 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
return true;
|
||||
}
|
||||
|
||||
case OSD_G_FORCE:
|
||||
{
|
||||
float osdGForce = 0;
|
||||
for (int axis = 0; axis < 3; axis++) {
|
||||
const float a = accAverage[axis];
|
||||
osdGForce += a * a;
|
||||
}
|
||||
osdGForce = sqrtf(osdGForce) / acc.dev.acc_1G * 10;
|
||||
tfp_sprintf(buff, "%01d.%01d%c", (uint8_t)osdGForce / 10, (uint8_t)osdGForce % 10, "G");
|
||||
break;
|
||||
}
|
||||
|
||||
case OSD_ROLL_PIDS:
|
||||
osdFormatPID(buff, "ROL", ¤tPidProfile->pid[PID_ROLL]);
|
||||
break;
|
||||
|
@ -963,6 +976,7 @@ static void osdDrawElements(void)
|
|||
|
||||
if (sensors(SENSOR_ACC)) {
|
||||
osdDrawSingleElement(OSD_ARTIFICIAL_HORIZON);
|
||||
osdDrawSingleElement(OSD_G_FORCE);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue