Mount_AlexMos: use SerialManager for init

This commit is contained in:
Randy Mackay 2015-01-19 22:38:49 +09:00 committed by Andrew Tridgell
parent 56f872b38c
commit 4848b03ac6
2 changed files with 13 additions and 8 deletions

View File

@ -3,13 +3,16 @@
extern const AP_HAL::HAL& hal;
void AP_Mount_Alexmos::init ()
void AP_Mount_Alexmos::init(const AP_SerialManager& serial_manager)
{
_port = hal.uartE;
_port->begin(115200);
_initialised = true;
get_boardinfo();
read_params(0); //we request parameters for profile 0 and therfore get global and profile parameters
// check for alexmos protcol
AP_SerialManager::serial_state alexmos_serial;
if (serial_manager.find_serial(AP_SerialManager::SerialProtocol_AlexMos, alexmos_serial)) {
_port = alexmos_serial.uart;
_initialised = true;
get_boardinfo();
read_params(0); //we request parameters for profile 0 and therfore get global and profile parameters
}
}
// update mount position - should be called periodically

View File

@ -72,6 +72,7 @@ public:
//constructor
AP_Mount_Alexmos(AP_Mount &frontend, AP_Mount::mount_state state, uint8_t instance):
AP_Mount_Backend(frontend, state, instance),
_port(NULL),
_initialised(false),
_board_version(0),
_current_firmware_version(0.0f),
@ -84,11 +85,12 @@ public:
_step(0),
_command_id(0),
_payload_length(0),
_payload_counter(0)
_payload_counter(0),
_last_command_confirmed(false)
{}
// init - performs any required initialisation for this instance
virtual void init ();
virtual void init(const AP_SerialManager& serial_manager);
// update mount position - should be called periodically
virtual void update();