1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-20 23:05:17 +03:00

FEATURE FW_LAUNCH initial commit

This commit is contained in:
giacomo892 2018-02-05 17:26:38 +01:00
parent 8ed2fe656f
commit c3464ed48a
6 changed files with 27 additions and 7 deletions

View file

@ -160,7 +160,8 @@ static const char * const featureNames[] = {
"", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DASHBOARD", "",
"BLACKBOX", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE",
"SUPEREXPO", "VTX", "RX_SPI", "", "PWM_SERVO_DRIVER", "PWM_OUTPUT_ENABLE", "OSD", NULL
"SUPEREXPO", "VTX", "RX_SPI", "", "PWM_SERVO_DRIVER", "PWM_OUTPUT_ENABLE", "OSD", "FW_LAUNCH", NULL
};
/* Sensor names (used in lookup tables for *_hardware settings and in status command output) */

View file

@ -73,6 +73,7 @@ typedef enum {
FEATURE_PWM_SERVO_DRIVER = 1 << 27,
FEATURE_PWM_OUTPUT_ENABLE = 1 << 28,
FEATURE_OSD = 1 << 29,
FEATURE_FW_LAUNCH = 1 << 30,
} features_e;
typedef struct systemConfig_s {

View file

@ -188,7 +188,7 @@ static void updateArmingStatus(void)
}
/* CHECK: pitch / roll sticks centered when NAV_LAUNCH_MODE enabled */
if (IS_RC_MODE_ACTIVE(BOXNAVLAUNCH)) {
if (isNavLaunchEnabled()) {
if ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband)) {
ENABLE_ARMING_FLAG(ARMING_DISABLED_ROLLPITCH_NOT_CENTERED);
} else {

View file

@ -187,7 +187,9 @@ void initActiveBoxIds(void)
if (STATE(FIXED_WING)) {
activeBoxIds[activeBoxIdCount++] = BOXMANUAL;
activeBoxIds[activeBoxIdCount++] = BOXNAVLAUNCH;
if (!feature(FEATURE_FW_LAUNCH)) {
activeBoxIds[activeBoxIdCount++] = BOXNAVLAUNCH;
}
activeBoxIds[activeBoxIdCount++] = BOXAUTOTRIM;
#if defined(AUTOTUNE_FIXED_WING)
activeBoxIds[activeBoxIdCount++] = BOXAUTOTUNE;

View file

@ -1232,6 +1232,14 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_LAUNCH_WAIT(navigationF
return NAV_FSM_EVENT_SUCCESS; // NAV_STATE_LAUNCH_MOTOR_DELAY
}
//allow to leave NAV_LAUNCH_MODE if it has being enabled as feature by moving sticks with low throttle.
if(feature(FEATURE_FW_LAUNCH)){
throttleStatus_e throttleStatus = calculateThrottleStatus();
if ((throttleStatus == THROTTLE_LOW) && ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband))){
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
}
}
return NAV_FSM_EVENT_NONE;
}
@ -2345,7 +2353,7 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
// LAUNCH mode has priority over any other NAV mode
if (STATE(FIXED_WING)) {
if (IS_RC_MODE_ACTIVE(BOXNAVLAUNCH)) { // FIXME: Only available for fixed wing aircrafts now
if (isNavLaunchEnabled()) { // FIXME: Only available for fixed wing aircrafts now
if (canActivateLaunchMode) {
canActivateLaunchMode = false;
return NAV_FSM_EVENT_SWITCH_TO_LAUNCH;
@ -2404,8 +2412,8 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
else {
canActivateWaypoint = false;
// Launch mode can only be activated if BOX is turned on prior to arming (avoid switching to LAUNCH in flight)
canActivateLaunchMode = IS_RC_MODE_ACTIVE(BOXNAVLAUNCH);
// Launch mode can be activated if feature FW_LAUNCH is enabled or BOX is turned on prior to arming (avoid switching to LAUNCH in flight)
canActivateLaunchMode = isNavLaunchEnabled();
}
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
@ -2470,7 +2478,7 @@ int8_t navigationGetHeadingControlState(void)
bool navigationBlockArming(void)
{
const bool navBoxModesEnabled = IS_RC_MODE_ACTIVE(BOXNAVRTH) || IS_RC_MODE_ACTIVE(BOXNAVWP) || IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD);
const bool navLaunchComboModesEnabled = IS_RC_MODE_ACTIVE(BOXNAVLAUNCH) && (IS_RC_MODE_ACTIVE(BOXNAVRTH) || IS_RC_MODE_ACTIVE(BOXNAVWP));
const bool navLaunchComboModesEnabled = isNavLaunchEnabled() && (IS_RC_MODE_ACTIVE(BOXNAVRTH) || IS_RC_MODE_ACTIVE(BOXNAVWP));
bool shouldBlockArming = false;
if (!navConfig()->general.flags.extra_arming_safety)
@ -2701,6 +2709,10 @@ bool navigationRTHAllowsLanding(void)
(allow == NAV_RTH_ALLOW_LANDING_FS_ONLY && FLIGHT_MODE(FAILSAFE_MODE));
}
bool isNavLaunchEnabled(void)
{
return IS_RC_MODE_ACTIVE(BOXNAVLAUNCH) || feature(FEATURE_FW_LAUNCH);
}
#else // NAV
#ifdef USE_GPS

View file

@ -23,6 +23,8 @@
#include "io/gps.h"
#include "config/feature.h"
/* GPS Home location data */
extern gpsLocation_t GPS_home;
extern uint16_t GPS_distanceToHome; // distance to home point in meters
@ -315,6 +317,8 @@ bool navigationIsFlyingAutonomousMode(void);
*/
bool navigationRTHAllowsLanding(void);
bool isNavLaunchEnabled(void);
/* Compatibility data */
extern navSystemStatus_t NAV_Status;