From 4848b03ac60e9bea787067f02b7ba9862d6fd7db Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 19 Jan 2015 22:38:49 +0900 Subject: [PATCH] Mount_AlexMos: use SerialManager for init --- libraries/AP_Mount/AP_Mount_Alexmos.cpp | 15 +++++++++------ libraries/AP_Mount/AP_Mount_Alexmos.h | 6 ++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.cpp b/libraries/AP_Mount/AP_Mount_Alexmos.cpp index cc35b47121..a70e60ff7b 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.cpp +++ b/libraries/AP_Mount/AP_Mount_Alexmos.cpp @@ -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 diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.h b/libraries/AP_Mount/AP_Mount_Alexmos.h index 13a54069a4..9bb1353602 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.h +++ b/libraries/AP_Mount/AP_Mount_Alexmos.h @@ -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();