Skip to content

Commit

Permalink
AP_RCTelemetry: Fix Baro and Vario values
Browse files Browse the repository at this point in the history
Add the missing byte swapping for 16bit values
  • Loading branch information
Frank0587 committed Oct 29, 2024
1 parent a6f00a3 commit 4733400
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_RCTelemetry/AP_CRSF_Telem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ int8_t AP_CRSF_Telem::get_vertical_speed_packed()
// prepare vario data
void AP_CRSF_Telem::calc_baro_vario()
{
_telem.bcast.baro_vario.altitude_packed = get_altitude_packed();
_telem.bcast.baro_vario.altitude_packed = htobe16(get_altitude_packed());
_telem.bcast.baro_vario.vertical_speed_packed = get_vertical_speed_packed();

_telem_size = sizeof(BaroVarioFrame);
Expand All @@ -987,7 +987,7 @@ void AP_CRSF_Telem::calc_baro_vario()
// prepare vario data
void AP_CRSF_Telem::calc_vario()
{
_telem.bcast.vario.v_speed = int16_t(get_vspeed_ms() * 100.0f);
_telem.bcast.vario.v_speed = htobe16(int16_t(get_vspeed_ms() * 100.0f));
_telem_size = sizeof(VarioFrame);
_telem_type = AP_RCProtocol_CRSF::CRSF_FRAMETYPE_VARIO;

Expand Down

0 comments on commit 4733400

Please sign in to comment.