From 043c80dbe6008182ce9d62d0129798c3ae70bc72 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 13 Feb 2014 17:08:09 +1100 Subject: [PATCH] Plane: use new board_voltage() method --- ArduPlane/ArduPlane.pde | 4 ---- ArduPlane/GCS_Mavlink.pde | 2 +- ArduPlane/Log.pde | 2 +- ArduPlane/system.pde | 9 --------- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 99347e2bc9..50a6ef8800 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -314,8 +314,6 @@ static AP_SpdHgtControl *SpdHgt_Controller = &TECS_controller; // a pin for reading the receiver RSSI voltage. static AP_HAL::AnalogSource *rssi_analog_source; -static AP_HAL::AnalogSource *vcc_pin; - //////////////////////////////////////////////////////////////////////////////// // Sonar //////////////////////////////////////////////////////////////////////////////// @@ -757,8 +755,6 @@ void setup() { rssi_analog_source = hal.analogin->channel(ANALOG_INPUT_NONE); - vcc_pin = hal.analogin->channel(ANALOG_INPUT_BOARD_VCC); - init_ardupilot(); // initialise the main loop scheduler diff --git a/ArduPlane/GCS_Mavlink.pde b/ArduPlane/GCS_Mavlink.pde index 93b201fdd8..706b97139e 100644 --- a/ArduPlane/GCS_Mavlink.pde +++ b/ArduPlane/GCS_Mavlink.pde @@ -532,7 +532,7 @@ static void NOINLINE send_hwstatus(mavlink_channel_t chan) { mavlink_msg_hwstatus_send( chan, - board_voltage(), + hal.analogin->board_voltage()*1000, hal.i2c->lockup_count()); } diff --git a/ArduPlane/Log.pde b/ArduPlane/Log.pde index fa866ca5c8..0621afc90b 100644 --- a/ArduPlane/Log.pde +++ b/ArduPlane/Log.pde @@ -441,7 +441,7 @@ static void Log_Write_Current() throttle_in : channel_throttle->control_in, battery_voltage : (int16_t)(battery.voltage() * 100.0), current_amps : (int16_t)(battery.current_amps() * 100.0), - board_voltage : board_voltage(), + board_voltage : (uint16_t)(hal.analogin->board_voltage()*1000), current_total : battery.current_total_mah() }; DataFlash.WriteBlock(&pkt, sizeof(pkt)); diff --git a/ArduPlane/system.pde b/ArduPlane/system.pde index 12f0e5d8f1..4a4e100634 100644 --- a/ArduPlane/system.pde +++ b/ArduPlane/system.pde @@ -535,15 +535,6 @@ static void check_usb_mux(void) } -/* - * Read Vcc vs 1.1v internal reference - */ -uint16_t board_voltage(void) -{ - return vcc_pin->voltage_latest() * 1000; -} - - static void print_flight_mode(AP_HAL::BetterStream *port, uint8_t mode) {