GCS_MAVLink: move try_send_message handling of VIBRATION up

Also, use singleton to get ins
This commit is contained in:
Peter Barker 2018-05-02 19:27:31 +10:00 committed by WickedShell
parent 8108931ee0
commit e4b4a746e6
2 changed files with 9 additions and 2 deletions

View File

@ -173,7 +173,7 @@ public:
#endif
void send_autopilot_version() const;
void send_local_position() const;
void send_vibration(const AP_InertialSensor &ins) const;
void send_vibration() const;
void send_home(const Location &home) const;
void send_ekf_origin(const Location &ekf_origin) const;
void send_servo_output_raw(bool hil);

View File

@ -1496,8 +1496,10 @@ void GCS_MAVLINK::send_local_position() const
/*
send VIBRATION message
*/
void GCS_MAVLINK::send_vibration(const AP_InertialSensor &ins) const
void GCS_MAVLINK::send_vibration() const
{
const AP_InertialSensor &ins = AP::ins();
Vector3f vibration = ins.get_vibration_levels();
mavlink_msg_vibration_send(
@ -2671,6 +2673,11 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
send_ahrs();
break;
case MSG_VIBRATION:
CHECK_PAYLOAD_SIZE(VIBRATION);
send_vibration();
break;
default:
// try_send_message must always at some stage return true for
// a message, or we will attempt to infinitely retry the