Skip to content

Commit

Permalink
AP_GPS: use alt getter/setter instead of member
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Oct 19, 2024
1 parent d53bdb9 commit 7ff4ca9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS_Blended.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void AP_GPS_Blended::calc_state(void)
for (uint8_t i=0; i<GPS_MAX_RECEIVERS; i++) {
if (_blend_weights[i] > 0.0f && i != best_index) {
blended_NE_offset_m += state.location.get_distance_NE(gps.state[i].location) * _blend_weights[i];
blended_alt_offset_cm += (float)(gps.state[i].location.alt - state.location.alt) * _blend_weights[i];
blended_alt_offset_cm += (float)(gps.state[i].location.get_alt_cm() - state.location.get_alt_cm()) * _blend_weights[i];
}
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS_ExternalAHRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void AP_GPS_ExternalAHRS::handle_external(const AP_ExternalAHRS::gps_data_messag
Location loc = {};
loc.lat = pkt.latitude;
loc.lng = pkt.longitude;
loc.alt = pkt.msl_altitude;
loc.set_alt_cm(pkt.msl_altitude, Location::AltFrame::ABSOLUTE);

state.location = loc;
state.hdop = pkt.hdop;
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS_MAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void AP_GPS_MAV::handle_msg(const mavlink_message_t &msg)
loc.lat = packet.lat;
loc.lng = packet.lon;
if (have_alt) {
loc.alt = packet.alt * 100; // convert to centimeters
loc.set_alt_cm(packet.alt * 100, Location::AltFrame::ABSOLUTE);
}
state.location = loc;

Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS_MSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AP_GPS_MSP::handle_msp(const MSP::msp_gps_data_message_t &pkt)
Location loc = {};
loc.lat = pkt.latitude;
loc.lng = pkt.longitude;
loc.alt = pkt.msl_altitude;
loc.set_alt_cm(pkt.msl_altitude, Location::AltFrame::ABSOLUTE);

state.location = loc;
state.hdop = pkt.hdop;
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_GPS/AP_GPS_SBP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ AP_GPS_SBP::_attempt_state_update()

state.location.lat = (int32_t) (pos_llh->lat * (double)1e7);
state.location.lng = (int32_t) (pos_llh->lon * (double)1e7);
state.location.alt = (int32_t) (pos_llh->height * 100);
state.location.set_alt_cm((int32_t) (pos_llh->height * 100), Location::AltFrame::ABSOLUTE);
state.num_sats = pos_llh->n_sats;

if (pos_llh->flags == 0) {
Expand Down

0 comments on commit 7ff4ca9

Please sign in to comment.