Suppress OSD stats if disarming from crash-flip or untriggered launch control

The OSD stats provide no meaningful information and are just an annoyance when exiting these special states.

For Launch Control the stats will be displayed if the launch is triggered and normal flight occurrred.
This commit is contained in:
Bruce Luckcuck 2018-11-04 09:38:36 -05:00
parent 3492bcff3d
commit 98641cde75
5 changed files with 20 additions and 0 deletions

View File

@ -67,6 +67,7 @@
#include "io/beeper.h"
#include "io/gps.h"
#include "io/motors.h"
#include "io/osd.h"
#include "io/pidaudio.h"
#include "io/servos.h"
#include "io/serial.h"
@ -332,6 +333,12 @@ void disarm(void)
DISABLE_ARMING_FLAG(ARMED);
lastDisarmTimeUs = micros();
#ifdef USE_OSD
if (flipOverAfterCrashActive || isLaunchControlActive()) {
osdSuppressStats(true);
}
#endif
#ifdef USE_BLACKBOX
if (blackboxConfig()->device && blackboxConfig()->mode != BLACKBOX_MODE_ALWAYS_ON) { // Close the log upon disarm except when logging mode is ALWAYS ON
blackboxFinish();
@ -408,6 +415,9 @@ void tryArm(void)
}
#endif
#ifdef USE_OSD
osdSuppressStats(false);
#endif
ENABLE_ARMING_FLAG(ARMED);
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);

View File

@ -152,6 +152,8 @@ static bool lastArmState;
static displayPort_t *osdDisplayPort;
static bool suppressStatsDisplay = false;
#ifdef USE_ESC_SENSOR
static escSensorData_t *escDataCombined;
#endif
@ -1665,6 +1667,7 @@ STATIC_UNIT_TESTED void osdRefresh(timeUs_t currentTimeUs)
osdShowArmed();
resumeRefreshAt = currentTimeUs + (REFRESH_1S / 2);
} else if (isSomeStatEnabled()
&& !suppressStatsDisplay
&& (!(getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF)
|| !VISIBLE(osdConfig()->item_pos[OSD_WARNINGS]))) { // suppress stats if runaway takeoff triggered disarm and WARNINGS element is visible
osdStatsEnabled = true;
@ -1796,4 +1799,8 @@ void osdUpdate(timeUs_t currentTimeUs)
#endif
}
void osdSuppressStats(bool flag)
{
suppressStatsDisplay = flag;
}
#endif // USE_OSD

View File

@ -218,5 +218,6 @@ void osdStatSetState(uint8_t statIndex, bool enabled);
bool osdStatGetState(uint8_t statIndex);
void osdWarnSetState(uint8_t warningIndex, bool enabled);
bool osdWarnGetState(uint8_t warningIndex);
void osdSuppressStats(bool flag);

View File

@ -851,4 +851,5 @@ extern "C" {
bool usbCableIsInserted(void) { return false; }
bool usbVcpIsConnected(void) { return false; }
void pidSetAntiGravityState(bool) {}
void osdSuppressStats(bool) {}
}

View File

@ -173,4 +173,5 @@ extern "C" {
bool usbCableIsInserted(void) { return false; }
bool usbVcpIsConnected(void) { return false; }
void pidSetAntiGravityState(bool newState) { UNUSED(newState); }
void osdSuppressStats(bool) {}
}