Skip to content

Commit

Permalink
AP_Rally: add alt_frame to unused flag bits
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 authored and tridge committed Nov 1, 2023
1 parent d25d1c2 commit cd621f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 1 addition & 5 deletions libraries/AP_Rally/AP_Rally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,9 @@ Location AP_Rally::rally_location_to_location(const RallyLocation &rally_loc) co
rally_loc.lat,
rally_loc.lng,
rally_loc.alt * 100,
Location::AltFrame::ABOVE_HOME
(rally_loc.alt_frame_valid == 1) ? Location::AltFrame(rally_loc.alt_frame) : Location::AltFrame::ABOVE_HOME
};

// notionally the following call can fail, but we have no facility
// to return that fact here:
ret.change_alt_frame(Location::AltFrame::ABSOLUTE);

return ret;
}

Expand Down
13 changes: 10 additions & 3 deletions libraries/AP_Rally/AP_Rally.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ struct PACKED RallyLocation {
int16_t alt; //transit altitude (and loiter altitude) in meters (absolute);
int16_t break_alt; //when autolanding, break out of loiter at this alt (meters)
uint16_t land_dir; //when the time comes to auto-land, try to land in this direction (centidegrees)
uint8_t flags; //bit 0 = seek favorable winds when choosing a landing poi
//bit 1 = do auto land after arriving
//all other bits are for future use.
union {
uint8_t flags;
struct {
uint8_t favorable_winds : 1; // bit 0 = seek favorable winds when choosing a landing poi
uint8_t do_auto_land : 1; // bit 1 = do auto land after arriving
uint8_t alt_frame_valid : 1; // bit 2 = true if following alt frame value should be used, else Location::AltFrame::ABOVE_HOME
uint8_t alt_frame : 2; // Altitude frame following Location::AltFrame enum
uint8_t unused : 3;
};
};
};

/// @class AP_Rally
Expand Down

0 comments on commit cd621f0

Please sign in to comment.