diff --git a/libraries/AP_Rally/AP_Rally.cpp b/libraries/AP_Rally/AP_Rally.cpp index c8c586e5b01aa..d3b8284a963aa 100644 --- a/libraries/AP_Rally/AP_Rally.cpp +++ b/libraries/AP_Rally/AP_Rally.cpp @@ -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; } diff --git a/libraries/AP_Rally/AP_Rally.h b/libraries/AP_Rally/AP_Rally.h index 0eda3e2fd826a..0b4f34957e548 100644 --- a/libraries/AP_Rally/AP_Rally.h +++ b/libraries/AP_Rally/AP_Rally.h @@ -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