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

Autoland fix rc1 #22

Merged
merged 6 commits into from
Mar 9, 2024
Merged
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/runtime_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ typedef enum {
TURTLE_MODE = (1 << 15),
SOARING_MODE = (1 << 16),
ANGLEHOLD_MODE = (1 << 17),
NAV_FW_AUTOLAND = (1 << 18)
} flightModeFlags_e;

extern uint32_t flightModeFlags;
Expand Down
2 changes: 1 addition & 1 deletion src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ static float computePidLevelTarget(flight_dynamics_index_t axis) {

// Automatically pitch down if the throttle is manually controlled and reduced bellow cruise throttle
#ifdef USE_FW_AUTOLAND
if ((axis == FD_PITCH) && STATE(AIRPLANE) && FLIGHT_MODE(ANGLE_MODE) && !navigationIsControllingThrottle() && !isFwLandInProgess()) {
if ((axis == FD_PITCH) && STATE(AIRPLANE) && FLIGHT_MODE(ANGLE_MODE) && !navigationIsControllingThrottle() && ! FLIGHT_MODE(NAV_FW_AUTOLAND)) {
#else
if ((axis == FD_PITCH) && STATE(AIRPLANE) && FLIGHT_MODE(ANGLE_MODE) && !navigationIsControllingThrottle()) {
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ static const char * osdFailsafePhaseMessage(void)

static const char * osdFailsafeInfoMessage(void)
{
if (failsafeIsReceivingRxData()) {
if (failsafeIsReceivingRxData() && !FLIGHT_MODE(NAV_FW_AUTOLAND)) {
// User must move sticks to exit FS mode
return OSD_MESSAGE_STR(OSD_MSG_MOVE_EXIT_FS);
}
Expand Down Expand Up @@ -2277,7 +2277,7 @@ static bool osdDrawSingleElement(uint8_t item)
{
char *p = "ACRO";
#ifdef USE_FW_AUTOLAND
if (isFwLandInProgess())
if (FLIGHT_MODE(NAV_FW_AUTOLAND))
p = "LAND";
else
#endif
Expand Down Expand Up @@ -5142,7 +5142,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter

if (ARMING_FLAG(ARMED)) {
#ifdef USE_FW_AUTOLAND
if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding() || isFwLandInProgess()) {
if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding() || FLIGHT_MODE(NAV_FW_AUTOLAND)) {
if (isWaypointMissionRTHActive() && !posControl.fwLandState.landWp) {
#else
if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) {
Expand Down Expand Up @@ -5183,7 +5183,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter
#ifdef USE_FW_AUTOLAND
if (canFwLandCanceld()) {
messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS);
} else if (!isFwLandInProgess()) {
} else if (!FLIGHT_MODE(NAV_FW_AUTOLAND)) {
#endif
const char *navStateMessage = navigationStateMessage();
if (navStateMessage) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/io/osd_dji_hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,11 @@ static bool djiFormatMessages(char *buff)
if (FLIGHT_MODE(MANUAL_MODE)) {
messages[messageCount++] = "(MANUAL)";
}

if (FLIGHT_MODE(NAV_FW_AUTOLAND)) {
messages[messageCount++] = "(LAND)";
}

}
}
// Pick one of the available messages. Each message lasts
Expand Down
124 changes: 65 additions & 59 deletions src/main/navigation/navigation.c

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/main/navigation/navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ uint8_t getActiveWpNumber(void);
int32_t navigationGetHomeHeading(void);

#ifdef USE_FW_AUTOLAND
bool isFwLandInProgess(void);
bool canFwLandCanceld(void);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/main/navigation/navigation_fixedwing.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ void applyFixedWingPitchRollThrottleController(navigationFSMStateFlags_t navStat

// Manual throttle increase
#ifdef USE_FW_AUTOLAND
if (navConfig()->fw.allow_manual_thr_increase && !FLIGHT_MODE(FAILSAFE_MODE) && !isFwLandInProgess()) {
if (navConfig()->fw.allow_manual_thr_increase && !FLIGHT_MODE(FAILSAFE_MODE) && !FLIGHT_MODE(NAV_FW_AUTOLAND)) {
#else
if (navConfig()->fw.allow_manual_thr_increase && !FLIGHT_MODE(FAILSAFE_MODE)) {
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/main/programming/logic_condition.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ static int logicConditionGetFlightOperandValue(int operand) {

case LOGIC_CONDITION_OPERAND_FLIGHT_IS_LANDING: // 0/1
#ifdef USE_FW_AUTOLAND
return ((navGetCurrentStateFlags() & NAV_CTL_LAND) || isFwLandInProgess()) ? 1 : 0;
return ((navGetCurrentStateFlags() & NAV_CTL_LAND) || FLIGHT_MODE(NAV_FW_AUTOLAND)) ? 1 : 0;
#else
return ((navGetCurrentStateFlags() & NAV_CTL_LAND)) ? 1 : 0;
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/main/telemetry/crsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ static void crsfFrameFlightMode(sbuf_t *dst)
} else if (FLIGHT_MODE(ANGLEHOLD_MODE)) {
flightMode = "ANGH";
}
#ifdef USE_FW_AUTOLAND
} else if (FLIGHT_MODE(NAV_FW_AUTOLAND)) {
flightMode = "LAND"
}
#endif
#ifdef USE_GPS
} else if (feature(FEATURE_GPS) && navConfig()->general.flags.extra_arming_safety && (!STATE(GPS_FIX) || !STATE(GPS_FIX_HOME))) {
flightMode = "WAIT"; // Waiting for GPS lock
Expand Down
4 changes: 4 additions & 0 deletions src/main/telemetry/ltm.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ void ltm_sframe(sbuf_t *dst)
lt_flightmode = LTM_MODE_ANGLE;
else if (FLIGHT_MODE(HORIZON_MODE))
lt_flightmode = LTM_MODE_HORIZON;
#ifdef USE_FW_AUTOLAND
else if (FLIGHT_MODE(NAV_FW_AUTOLAND))
lt_flightmode = LTM_MODE_LAND;
#endif
else
lt_flightmode = LTM_MODE_RATE; // Rate mode

Expand Down
Loading