Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep arm status over MSP if in emergency re-arm period #10462

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/fc/fc_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void tryArm(void);
disarmReason_t getDisarmReason(void);

bool emergencyArmingUpdate(bool armingSwitchIsOn, bool forceArm);
bool emergInflightRearmEnabled(void);

bool areSensorsCalibrating(void);
float getFlightTime(void);
Expand Down
28 changes: 28 additions & 0 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,23 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
sbufWriteU8(dst, getConfigProfile());

if (cmdMSP == MSP_STATUS_EX) {
#if defined(USE_OSD) && defined(USE_MSP_OSD)
bool armingBit = bitArrayGet(mspBoxModeFlags.bits, BOXARM);
// If we are in emergency re-arm period and using MSP DisplayPort OSD, show that we are still Armed to prevent the VTX entering low power mode
if (feature(FEATURE_OSD) && emergInflightRearmEnabled())
bitArraySet(mspBoxModeFlags.bits, BOXARM);
#endif

sbufWriteU16(dst, averageSystemLoadPercent);
sbufWriteU16(dst, armingFlags);
sbufWriteU8(dst, accGetCalibrationAxisFlags());

#if defined(USE_OSD) && defined(USE_MSP_OSD)
if (armingBit)
bitArraySet(mspBoxModeFlags.bits, BOXARM);
else
bitArrayClr(mspBoxModeFlags.bits, BOXARM);
#endif
}
}
break;
Expand All @@ -467,12 +481,26 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
#else
sbufWriteU16(dst, 0);
#endif

#if defined(USE_OSD) && defined(USE_MSP_OSD)
bool armingBit = bitArrayGet(mspBoxModeFlags.bits, BOXARM);
// If we are in emergency re-arm period and using MSP DisplayPort OSD, show that we are still Armed to prevent the VTX entering low power mode
if (feature(FEATURE_OSD) && emergInflightRearmEnabled())
bitArraySet(mspBoxModeFlags.bits, BOXARM);
#endif
sbufWriteU16(dst, packSensorStatus());
sbufWriteU16(dst, averageSystemLoadPercent);
sbufWriteU8(dst, (getConfigBatteryProfile() << 4) | getConfigProfile());
sbufWriteU32(dst, armingFlags);
sbufWriteData(dst, &mspBoxModeFlags, sizeof(mspBoxModeFlags));
sbufWriteU8(dst, getConfigMixerProfile());

#if defined(USE_OSD) && defined(USE_MSP_OSD)
if (armingBit)
bitArraySet(mspBoxModeFlags.bits, BOXARM);
else
bitArrayClr(mspBoxModeFlags.bits, BOXARM);
#endif
}
break;

Expand Down
Loading