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

add "current_distance" from mavlink #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions TelemetryCore/src/main/cpp/SharedCppC/UAVTelemetryData.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ typedef struct {
int DJI_linkQualityDown_P;
float DJI_Gimbal_Attitude_Yaw_Degree;

float Distance_m; // Current distance reading of the rangefinder

} UAVTelemetryData;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ MTelemetryValue TelemetryReceiver::getTelemetryValue(TelemetryValueIndex index)
ret.metric=L"m";
}
break;
case DISTANCE:{
ret.prefix=L"Range";
ret.value= StringHelper::doubleToWString(uav_td.Distance_m, 5, 2);
ret.metric=L"m";
}
break;
case LONGITUDE:{
ret.prefix=L"Lon";
ret.prefixIcon=ICON_LONGITUDE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class TelemetryReceiver {
EZWB_RSSI_ADAPTER3,
//EZWB_RSSI_ADAPTER4,
//EZWB_RSSI_ADAPTER5,
DISTANCE,
XXX
};
MTelemetryValue getTelemetryValue(TelemetryValueIndex index) const ;
Expand Down
4 changes: 4 additions & 0 deletions TelemetryCore/src/main/cpp/parser_c/mavlink2.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ void mavlink_read_v2(UAVTelemetryData *td,OriginData *originData,const uint8_t *
}
break;
}
case MAVLINK_MSG_ID_DISTANCE_SENSOR:{
td->Distance_m = mavlink_msg_distance_sensor_get_current_distance(&msg)/100.0f;
break;
}
default:
//__android_log_print(ANDROID_LOG_DEBUG,"Message:","%d",msg.msgid);
break;
Expand Down