diff options
author | Andreas Antener <antener_a@gmx.ch> | 2015-04-18 23:35:28 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-21 07:01:44 +0200 |
commit | 92bdf74423d6feff3fa9ab3e721320138631a86f (patch) | |
tree | 199bbe3e114176d54fe4e5e1c93f1381cda9b35d /src/drivers | |
parent | 8279de5a0b9f1ea0d0535c1de856d2344178deac (diff) | |
download | px4-firmware-92bdf74423d6feff3fa9ab3e721320138631a86f.tar.gz px4-firmware-92bdf74423d6feff3fa9ab3e721320138631a86f.tar.bz2 px4-firmware-92bdf74423d6feff3fa9ab3e721320138631a86f.zip |
overwrite rc in rssi with value from pwm input, parameters hardcoded
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; } |