1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Merge pull request #7041 from etracer65/suppress_osd_stats_turtle_launch

Suppress OSD stats if disarming from crash-flip or untriggered launch control
This commit is contained in:
Michael Keller 2018-11-09 02:29:45 +13:00 committed by GitHub
commit 11c0979a0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 0 deletions

View file

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

View file

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

View file

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

View file

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

View file

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