From ee369f8a0d0548ce6d94e13f4baec909806ded21 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 19 Jan 2015 10:40:51 +0900 Subject: [PATCH] Mount_AlexMos: use reference to state --- libraries/AP_Mount/AP_Mount_Alexmos.cpp | 8 ++++---- libraries/AP_Mount/AP_Mount_Alexmos.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.cpp b/libraries/AP_Mount/AP_Mount_Alexmos.cpp index 87516f5303..cc35b47121 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.cpp +++ b/libraries/AP_Mount/AP_Mount_Alexmos.cpp @@ -25,12 +25,12 @@ void AP_Mount_Alexmos::update() switch(_frontend.get_mode(_instance)) { // move mount to a "retracted" position. we do not implement a separate servo based retract mechanism case MAV_MOUNT_MODE_RETRACT: - control_axis(_frontend.state[_instance]._retract_angles.get(), true); + control_axis(_state._retract_angles.get(), true); break; // move mount to a neutral position, typically pointing forward case MAV_MOUNT_MODE_NEUTRAL: - control_axis(_frontend.state[_instance]._neutral_angles.get(), true); + control_axis(_state._neutral_angles.get(), true); break; // point to the angles given by a mavlink message @@ -48,7 +48,7 @@ void AP_Mount_Alexmos::update() // point mount to a GPS point given by the mission planner case MAV_MOUNT_MODE_GPS_POINT: if(_frontend._ahrs.get_gps().status() >= AP_GPS::GPS_OK_FIX_2D) { - calc_angle_to_location(_frontend.state[_instance]._roi_target, _angle_ef_target_rad, true, false); + calc_angle_to_location(_state._roi_target, _angle_ef_target_rad, true, false); control_axis(_angle_ef_target_rad, false); } break; @@ -69,7 +69,7 @@ bool AP_Mount_Alexmos::has_pan_control() const void AP_Mount_Alexmos::set_mode(enum MAV_MOUNT_MODE mode) { // record the mode change and return success - _frontend.state[_instance]._mode = mode; + _state._mode = mode; } // status_msg - called to allow mounts to send their status to GCS using the MOUNT_STATUS message diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.h b/libraries/AP_Mount/AP_Mount_Alexmos.h index 52c6acf84d..13a54069a4 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.h +++ b/libraries/AP_Mount/AP_Mount_Alexmos.h @@ -70,8 +70,8 @@ class AP_Mount_Alexmos : public AP_Mount_Backend { public: //constructor - AP_Mount_Alexmos(AP_Mount &frontend, uint8_t instance): - AP_Mount_Backend(frontend, instance), + AP_Mount_Alexmos(AP_Mount &frontend, AP_Mount::mount_state state, uint8_t instance): + AP_Mount_Backend(frontend, state, instance), _initialised(false), _board_version(0), _current_firmware_version(0.0f),