aboutsummaryrefslogtreecommitdiff
path: root/src/modules/px4iofirmware/controls.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-01-26 14:13:57 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-26 14:13:57 +0100
commit16eb68f2e9b1de47b4f77d2ccaf72f102eb67fdf (patch)
treec6e09d9ca9b81c6f61129c7d754627a498beff0c /src/modules/px4iofirmware/controls.c
parenta737a2a4061babb3de524ac2001a659786081e4a (diff)
downloadpx4-firmware-16eb68f2e9b1de47b4f77d2ccaf72f102eb67fdf.tar.gz
px4-firmware-16eb68f2e9b1de47b4f77d2ccaf72f102eb67fdf.tar.bz2
px4-firmware-16eb68f2e9b1de47b4f77d2ccaf72f102eb67fdf.zip
Allow the setup flags to control the S.BUS / RSSI port instead of doing some wild, likely incorrect, guesses.
Diffstat (limited to 'src/modules/px4iofirmware/controls.c')
-rw-r--r--src/modules/px4iofirmware/controls.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c
index 1cac977d7..e70eaed09 100644
--- a/src/modules/px4iofirmware/controls.c
+++ b/src/modules/px4iofirmware/controls.c
@@ -98,13 +98,15 @@ controls_tick() {
uint16_t rssi = 0;
#ifdef ADC_RSSI
- unsigned counts = adc_measure(ADC_RSSI);
- if (counts != 0xffff) {
- /* use 1:1 scaling on 3.3V ADC input */
- unsigned mV = counts * 3300 / 4096;
-
- /* scale to 0..253 */
- rssi = mV / 13;
+ if (r_setup_features & PX4IO_P_SETUP_FEATURES_ADC_RSSI) {
+ unsigned counts = adc_measure(ADC_RSSI);
+ if (counts != 0xffff) {
+ /* use 1:1 scaling on 3.3V ADC input */
+ unsigned mV = counts * 3300 / 4096;
+
+ /* scale to 0..253 */
+ rssi = mV / 13;
+ }
}
#endif
@@ -150,13 +152,6 @@ controls_tick() {
}
- /* switch S.Bus output pin as needed */
- if (sbus_status != (r_status_flags & PX4IO_P_STATUS_FLAGS_RC_SBUS)) {
- #ifdef ENABLE_SBUS_OUT
- ENABLE_SBUS_OUT((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_SBUS));
- #endif
- }
-
perf_end(c_gather_sbus);
/*