Browse Source

Added missing channel count in px4io driver

sbg
Lorenz Meier 12 years ago
parent
commit
050698bedc
  1. 1
      apps/drivers/px4io/px4io.cpp
  2. 6
      apps/sensors/sensors.cpp

1
apps/drivers/px4io/px4io.cpp

@ -467,6 +467,7 @@ PX4IO::rx_callback(const uint8_t *buffer, size_t bytes_received)
/* publish raw rc channel values from IO */ /* publish raw rc channel values from IO */
_input_rc.timestamp = hrt_absolute_time(); _input_rc.timestamp = hrt_absolute_time();
_input_rc.channel_count = rep->channel_count;
for (int i = 0; i < rep->channel_count; i++) for (int i = 0; i < rep->channel_count; i++)
{ {
_input_rc.values[i] = rep->rc_channel[i]; _input_rc.values[i] = rep->rc_channel[i];

6
apps/sensors/sensors.cpp

@ -93,6 +93,8 @@
#define BAT_VOL_LOWPASS_2 0.01f #define BAT_VOL_LOWPASS_2 0.01f
#define VOLTAGE_BATTERY_IGNORE_THRESHOLD_VOLTS 3.5f #define VOLTAGE_BATTERY_IGNORE_THRESHOLD_VOLTS 3.5f
#define PPM_INPUT_TIMEOUT_INTERVAL 50000 /**< 50 ms timeout / 20 Hz */
/** /**
* Sensor app start / stop handling function * Sensor app start / stop handling function
* *
@ -865,8 +867,10 @@ Sensors::ppm_poll()
struct rc_input_values raw; struct rc_input_values raw;
raw.timestamp = ppm_last_valid_decode; raw.timestamp = ppm_last_valid_decode;
/* we are accepting this message */
_ppm_last_valid = ppm_last_valid_decode;
if (ppm_decoded_channels > 1) { if (ppm_decoded_channels > 2 && hrt_absolute_time() - _ppm_last_valid < PPM_INPUT_TIMEOUT_INTERVAL) {
for (int i = 0; i < ppm_decoded_channels; i++) { for (int i = 0; i < ppm_decoded_channels; i++) {
raw.values[i] = ppm_buffer[i]; raw.values[i] = ppm_buffer[i];

Loading…
Cancel
Save