diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-12-30 10:49:27 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-12-30 10:49:27 +0100 |
commit | abe1b9759a7b4f3114a91aa63b1e8caf8d37d9aa (patch) | |
tree | eb3efcfbcb9ce87dbf8708755bf5eef761a159bd /apps/px4io/comms.c | |
parent | 142556b442b1c88ed2ede2cb9904a6a324051e71 (diff) | |
parent | f6ea42ab5e886b3475350c5dab95b5985bda26bc (diff) | |
download | px4-firmware-abe1b9759a7b4f3114a91aa63b1e8caf8d37d9aa.tar.gz px4-firmware-abe1b9759a7b4f3114a91aa63b1e8caf8d37d9aa.tar.bz2 px4-firmware-abe1b9759a7b4f3114a91aa63b1e8caf8d37d9aa.zip |
Merged IO mixing branch
Diffstat (limited to 'apps/px4io/comms.c')
-rw-r--r-- | apps/px4io/comms.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/px4io/comms.c b/apps/px4io/comms.c index df07c34d8..c208db3ad 100644 --- a/apps/px4io/comms.c +++ b/apps/px4io/comms.c @@ -71,6 +71,8 @@ static struct px4io_report report; static void comms_handle_frame(void *arg, const void *buffer, size_t length); +perf_counter_t comms_rx_errors; + static void comms_init(void) { @@ -78,6 +80,9 @@ comms_init(void) fmu_fd = open("/dev/ttyS1", O_RDWR); stream = hx_stream_init(fmu_fd, comms_handle_frame, NULL); + comms_rx_errors = perf_alloc(PC_COUNT, "rx_err"); + hx_stream_set_counters(stream, 0, 0, comms_rx_errors); + /* default state in the report to FMU */ report.i2f_magic = I2F_MAGIC; @@ -173,14 +178,12 @@ comms_handle_command(const void *buffer, size_t length) irqstate_t flags = irqsave(); /* fetch new PWM output values */ - for (unsigned i = 0; i < PX4IO_OUTPUT_CHANNELS; i++) { - system_state.fmu_channel_data[i] = cmd->servo_command[i]; - } + for (unsigned i = 0; i < PX4IO_CONTROL_CHANNELS; i++) + system_state.fmu_channel_data[i] = cmd->output_control[i]; - /* if IO is armed and FMU gets disarmed, IO must also disarm */ - if (system_state.arm_ok && !cmd->arm_ok) { + /* if the IO is armed and the FMU gets disarmed, the IO must also disarm */ + if (system_state.arm_ok && !cmd->arm_ok) system_state.armed = false; - } system_state.arm_ok = cmd->arm_ok; system_state.vector_flight_mode_ok = cmd->vector_flight_mode_ok; |