mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-21 15:25:29 +03:00
FEATURE FW_LAUNCH initial commit
This commit is contained in:
parent
8ed2fe656f
commit
c3464ed48a
6 changed files with 27 additions and 7 deletions
|
@ -160,7 +160,8 @@ static const char * const featureNames[] = {
|
||||||
"", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
|
"", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
|
||||||
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DASHBOARD", "",
|
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DASHBOARD", "",
|
||||||
"BLACKBOX", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE",
|
"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) */
|
/* Sensor names (used in lookup tables for *_hardware settings and in status command output) */
|
||||||
|
|
|
@ -73,6 +73,7 @@ typedef enum {
|
||||||
FEATURE_PWM_SERVO_DRIVER = 1 << 27,
|
FEATURE_PWM_SERVO_DRIVER = 1 << 27,
|
||||||
FEATURE_PWM_OUTPUT_ENABLE = 1 << 28,
|
FEATURE_PWM_OUTPUT_ENABLE = 1 << 28,
|
||||||
FEATURE_OSD = 1 << 29,
|
FEATURE_OSD = 1 << 29,
|
||||||
|
FEATURE_FW_LAUNCH = 1 << 30,
|
||||||
} features_e;
|
} features_e;
|
||||||
|
|
||||||
typedef struct systemConfig_s {
|
typedef struct systemConfig_s {
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void updateArmingStatus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CHECK: pitch / roll sticks centered when NAV_LAUNCH_MODE enabled */
|
/* 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)) {
|
if ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband)) {
|
||||||
ENABLE_ARMING_FLAG(ARMING_DISABLED_ROLLPITCH_NOT_CENTERED);
|
ENABLE_ARMING_FLAG(ARMING_DISABLED_ROLLPITCH_NOT_CENTERED);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -187,7 +187,9 @@ void initActiveBoxIds(void)
|
||||||
|
|
||||||
if (STATE(FIXED_WING)) {
|
if (STATE(FIXED_WING)) {
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXMANUAL;
|
activeBoxIds[activeBoxIdCount++] = BOXMANUAL;
|
||||||
|
if (!feature(FEATURE_FW_LAUNCH)) {
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXNAVLAUNCH;
|
activeBoxIds[activeBoxIdCount++] = BOXNAVLAUNCH;
|
||||||
|
}
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXAUTOTRIM;
|
activeBoxIds[activeBoxIdCount++] = BOXAUTOTRIM;
|
||||||
#if defined(AUTOTUNE_FIXED_WING)
|
#if defined(AUTOTUNE_FIXED_WING)
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXAUTOTUNE;
|
activeBoxIds[activeBoxIdCount++] = BOXAUTOTUNE;
|
||||||
|
|
|
@ -1232,6 +1232,14 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_LAUNCH_WAIT(navigationF
|
||||||
return NAV_FSM_EVENT_SUCCESS; // NAV_STATE_LAUNCH_MOTOR_DELAY
|
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;
|
return NAV_FSM_EVENT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,7 +2353,7 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
||||||
|
|
||||||
// LAUNCH mode has priority over any other NAV mode
|
// LAUNCH mode has priority over any other NAV mode
|
||||||
if (STATE(FIXED_WING)) {
|
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) {
|
if (canActivateLaunchMode) {
|
||||||
canActivateLaunchMode = false;
|
canActivateLaunchMode = false;
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_LAUNCH;
|
return NAV_FSM_EVENT_SWITCH_TO_LAUNCH;
|
||||||
|
@ -2404,8 +2412,8 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
||||||
else {
|
else {
|
||||||
canActivateWaypoint = false;
|
canActivateWaypoint = false;
|
||||||
|
|
||||||
// Launch mode can only be activated if BOX is turned on prior to arming (avoid switching to LAUNCH in flight)
|
// 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 = IS_RC_MODE_ACTIVE(BOXNAVLAUNCH);
|
canActivateLaunchMode = isNavLaunchEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
|
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
|
||||||
|
@ -2470,7 +2478,7 @@ int8_t navigationGetHeadingControlState(void)
|
||||||
bool navigationBlockArming(void)
|
bool navigationBlockArming(void)
|
||||||
{
|
{
|
||||||
const bool navBoxModesEnabled = IS_RC_MODE_ACTIVE(BOXNAVRTH) || IS_RC_MODE_ACTIVE(BOXNAVWP) || IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD);
|
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;
|
bool shouldBlockArming = false;
|
||||||
|
|
||||||
if (!navConfig()->general.flags.extra_arming_safety)
|
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));
|
(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
|
#else // NAV
|
||||||
|
|
||||||
#ifdef USE_GPS
|
#ifdef USE_GPS
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "io/gps.h"
|
#include "io/gps.h"
|
||||||
|
|
||||||
|
#include "config/feature.h"
|
||||||
|
|
||||||
/* GPS Home location data */
|
/* GPS Home location data */
|
||||||
extern gpsLocation_t GPS_home;
|
extern gpsLocation_t GPS_home;
|
||||||
extern uint16_t GPS_distanceToHome; // distance to home point in meters
|
extern uint16_t GPS_distanceToHome; // distance to home point in meters
|
||||||
|
@ -315,6 +317,8 @@ bool navigationIsFlyingAutonomousMode(void);
|
||||||
*/
|
*/
|
||||||
bool navigationRTHAllowsLanding(void);
|
bool navigationRTHAllowsLanding(void);
|
||||||
|
|
||||||
|
bool isNavLaunchEnabled(void);
|
||||||
|
|
||||||
/* Compatibility data */
|
/* Compatibility data */
|
||||||
extern navSystemStatus_t NAV_Status;
|
extern navSystemStatus_t NAV_Status;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue