From 92bdf74423d6feff3fa9ab3e721320138631a86f Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Sat, 18 Apr 2015 23:35:28 +0200 Subject: overwrite rc in rssi with value from pwm input, parameters hardcoded --- src/drivers/px4io/px4io.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 33125699f..3fa12261e 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -111,6 +111,10 @@ extern device::Device *PX4IO_serial_interface() weak_function; #define ORB_CHECK_INTERVAL 200000 // 200 ms -> 5 Hz #define IO_POLL_INTERVAL 20000 // 20 ms -> 50 Hz +#define RC_RSSI_PWM_MAX 1000 +#define RC_RSSI_PWM_MIN 1800 +#define RC_RSSI_PWM_CHAN 8 + /** * The PX4IO class. * @@ -1633,6 +1637,12 @@ PX4IO::io_get_raw_rc_input(rc_input_values &input_rc) input_rc.values[i] = regs[prolog + i]; } + // get RSSI from channel 8, input range 1000 - 2000 + if (RC_RSSI_PWM_CHAN > -1 && RC_RSSI_PWM_CHAN <= RC_INPUT_MAX_CHANNELS) { + input_rc.rssi = (input_rc.values[RC_RSSI_PWM_CHAN - 1] - RC_RSSI_PWM_MIN) * + ((RC_RSSI_PWM_MAX - RC_RSSI_PWM_MIN) / 255); + } + return ret; } -- cgit v1.2.3