mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 05:15:25 +03:00
Merge pull request #11621 from limonspb/flip_over_warning_show_before_arm
This commit is contained in:
commit
4fa2dc1115
4 changed files with 24 additions and 7 deletions
|
@ -440,7 +440,7 @@ void disarm(flightLogDisarmReason_e reason)
|
|||
lastDisarmTimeUs = micros();
|
||||
|
||||
#ifdef USE_OSD
|
||||
if (flipOverAfterCrashActive || isLaunchControlActive()) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH) || isLaunchControlActive()) {
|
||||
osdSuppressStats(true);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "drivers/sdcard.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/core.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
@ -79,6 +80,7 @@
|
|||
|
||||
#include "osd/osd.h"
|
||||
#include "osd/osd_elements.h"
|
||||
#include "osd/osd_warnings.h"
|
||||
|
||||
#include "pg/motor.h"
|
||||
#include "pg/pg.h"
|
||||
|
@ -1016,6 +1018,10 @@ static timeDelta_t osdShowArmed(void)
|
|||
}
|
||||
displayWrite(osdDisplayPort, 12, 7, DISPLAYPORT_ATTR_NONE, "ARMED");
|
||||
|
||||
if (isFlipOverAfterCrashActive()) {
|
||||
displayWrite(osdDisplayPort, 8, 8, DISPLAYPORT_ATTR_NONE, CRASH_FLIP_WARNING);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1087,8 +1093,9 @@ void osdProcessStats2(timeUs_t currentTimeUs)
|
|||
|
||||
if (resumeRefreshAt) {
|
||||
if (cmp32(currentTimeUs, resumeRefreshAt) < 0) {
|
||||
// in timeout period, check sticks for activity to resume display.
|
||||
if (IS_HI(THROTTLE) || IS_HI(PITCH)) {
|
||||
// in timeout period, check sticks for activity or CRASH FLIP switch to resume display.
|
||||
if (!ARMING_FLAG(ARMED) &&
|
||||
(IS_HI(THROTTLE) || IS_HI(PITCH) || IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH))) {
|
||||
resumeRefreshAt = currentTimeUs;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#include "sensors/battery.h"
|
||||
#include "sensors/sensors.h"
|
||||
|
||||
const char CRASH_FLIP_WARNING[] = "> CRASH FLIP <";
|
||||
|
||||
void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||
{
|
||||
const batteryState_e batteryState = getBatteryState();
|
||||
|
@ -132,10 +134,16 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
|||
}
|
||||
|
||||
// Warn when in flip over after crash mode
|
||||
if (osdWarnGetState(OSD_WARNING_CRASH_FLIP) && isFlipOverAfterCrashActive()) {
|
||||
tfp_sprintf(warningText, "CRASH FLIP");
|
||||
*displayAttr = DISPLAYPORT_ATTR_INFO;
|
||||
return;
|
||||
if (osdWarnGetState(OSD_WARNING_CRASH_FLIP) && IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) {
|
||||
if (isFlipOverAfterCrashActive()) { // if was armed in crash flip mode
|
||||
tfp_sprintf(warningText, CRASH_FLIP_WARNING);
|
||||
*displayAttr = DISPLAYPORT_ATTR_INFO;
|
||||
return;
|
||||
} else if (!ARMING_FLAG(ARMED)) { // if disarmed, but crash flip mode is activated
|
||||
tfp_sprintf(warningText, "CRASH FLIP SWITCH");
|
||||
*displayAttr = DISPLAYPORT_ATTR_INFO;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_LAUNCH_CONTROL
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#define OSD_WARNINGS_MAX_SIZE 12
|
||||
#define OSD_FORMAT_MESSAGE_BUFFER_SIZE (OSD_WARNINGS_MAX_SIZE + 1)
|
||||
|
||||
extern const char CRASH_FLIP_WARNING[];
|
||||
|
||||
STATIC_ASSERT(OSD_FORMAT_MESSAGE_BUFFER_SIZE <= OSD_ELEMENT_BUFFER_LENGTH, osd_warnings_size_exceeds_buffer_size);
|
||||
|
||||
void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue