diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-25 15:11:48 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-25 15:11:48 +0100 |
commit | edffade8cec2ea779040e97fb5478e0e9db12031 (patch) | |
tree | 1560c0e4cc3f5c58b092e86cd30beb7524ff5a46 /src/modules/px4iofirmware/controls.c | |
parent | a5023329920d5ce45c5bf48ae61d621947cdb349 (diff) | |
download | px4-firmware-edffade8cec2ea779040e97fb5478e0e9db12031.tar.gz px4-firmware-edffade8cec2ea779040e97fb5478e0e9db12031.tar.bz2 px4-firmware-edffade8cec2ea779040e97fb5478e0e9db12031.zip |
Added PPM frame length feedback in IO comms and status command - allows to warn users about badly formatted PPM frames
Diffstat (limited to 'src/modules/px4iofirmware/controls.c')
-rw-r--r-- | src/modules/px4iofirmware/controls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index 194d8aab9..58af77997 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -50,7 +50,7 @@ #define RC_CHANNEL_HIGH_THRESH 5000 #define RC_CHANNEL_LOW_THRESH -5000 -static bool ppm_input(uint16_t *values, uint16_t *num_values); +static bool ppm_input(uint16_t *values, uint16_t *num_values, uint16_t *frame_len); static perf_counter_t c_gather_dsm; static perf_counter_t c_gather_sbus; @@ -125,7 +125,7 @@ controls_tick() { * disable the PPM decoder completely if we have S.bus signal. */ perf_begin(c_gather_ppm); - bool ppm_updated = ppm_input(r_raw_rc_values, &r_raw_rc_count); + bool ppm_updated = ppm_input(r_raw_rc_values, &r_raw_rc_count, &r_page_status[PX4IO_P_STATUS_RC_DATA]); if (ppm_updated) { /* XXX sample RSSI properly here */ @@ -319,7 +319,7 @@ controls_tick() { } static bool -ppm_input(uint16_t *values, uint16_t *num_values) +ppm_input(uint16_t *values, uint16_t *num_values, uint16_t *frame_len) { bool result = false; @@ -343,6 +343,10 @@ ppm_input(uint16_t *values, uint16_t *num_values) /* clear validity */ ppm_last_valid_decode = 0; + /* store PPM frame length */ + if (num_values) + *frame_len = ppm_frame_length; + /* good if we got any channels */ result = (*num_values > 0); } |