1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-21 15:25:29 +03:00

Braking enabled only on a switch

This commit is contained in:
Pawel Spychalski (DzikuVx) 2018-05-12 15:41:03 +02:00
parent d1b064d4b8
commit 2fa3132e9a
3 changed files with 10 additions and 0 deletions

View file

@ -29,6 +29,7 @@
#include "fc/config.h" #include "fc/config.h"
#include "fc/fc_msp_box.h" #include "fc/fc_msp_box.h"
#include "fc/runtime_config.h" #include "fc/runtime_config.h"
#include "flight/mixer.h"
#include "io/osd.h" #include "io/osd.h"
@ -77,6 +78,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = {
{ BOXOSDALT1, "OSD ALT 1", 42 }, { BOXOSDALT1, "OSD ALT 1", 42 },
{ BOXOSDALT2, "OSD ALT 2", 43 }, { BOXOSDALT2, "OSD ALT 2", 43 },
{ BOXOSDALT3, "OSD ALT 3", 44 }, { BOXOSDALT3, "OSD ALT 3", 44 },
{ BOXBRAKING, "MC BRAKING", 45 },
{ CHECKBOX_ITEM_COUNT, NULL, 0xFF } { CHECKBOX_ITEM_COUNT, NULL, 0xFF }
}; };
@ -188,6 +190,11 @@ void initActiveBoxIds(void)
activeBoxIds[activeBoxIdCount++] = BOXHOMERESET; activeBoxIds[activeBoxIdCount++] = BOXHOMERESET;
activeBoxIds[activeBoxIdCount++] = BOXGCSNAV; activeBoxIds[activeBoxIdCount++] = BOXGCSNAV;
} }
if (mixerConfig()->platformType == PLATFORM_MULTIROTOR) {
activeBoxIds[activeBoxIdCount++] = BOXBRAKING;
}
#endif #endif
if (STATE(FIXED_WING)) { if (STATE(FIXED_WING)) {
@ -301,6 +308,7 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags)
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXOSDALT2)), BOXOSDALT2); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXOSDALT2)), BOXOSDALT2);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXOSDALT3)), BOXOSDALT3); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXOSDALT3)), BOXOSDALT3);
CHECK_ACTIVE_BOX(IS_ENABLED(navigationTerrainFollowingEnabled()), BOXSURFACE); CHECK_ACTIVE_BOX(IS_ENABLED(navigationTerrainFollowingEnabled()), BOXSURFACE);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXBRAKING)), BOXBRAKING);
memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t));
for (uint32_t i = 0; i < activeBoxIdCount; i++) { for (uint32_t i = 0; i < activeBoxIdCount; i++) {

View file

@ -59,6 +59,7 @@ typedef enum {
BOXOSDALT1 = 32, BOXOSDALT1 = 32,
BOXOSDALT2 = 33, BOXOSDALT2 = 33,
BOXOSDALT3 = 34, BOXOSDALT3 = 34,
BOXBRAKING = 35,
CHECKBOX_ITEM_COUNT CHECKBOX_ITEM_COUNT
} boxId_e; } boxId_e;

View file

@ -1976,6 +1976,7 @@ static bool adjustPositionFromRCInput(void)
* Process states only for POSHOLD. In any other case we go back to old routines * Process states only for POSHOLD. In any other case we go back to old routines
*/ */
if ( if (
IS_RC_MODE_ACTIVE(BOXBRAKING) &&
navConfig()->general.flags.user_control_mode == NAV_GPS_CRUISE && navConfig()->general.flags.user_control_mode == NAV_GPS_CRUISE &&
navConfig()->mc.braking_speed_threshold > 0 && navConfig()->mc.braking_speed_threshold > 0 &&
( (