minor changes for default options, closing properly all subscriptions in multirotor att control now on exit

This commit is contained in:
Lorenz Meier
2012-08-29 22:33:06 +02:00
parent 7cd89520cc
commit 676daf7c46
3 changed files with 8 additions and 9 deletions
@@ -43,6 +43,7 @@
#include <unistd.h>
#include <drivers/drv_gpio.h>
#include <arch/board/up_hrt.h>
#include <systemlib/err.h>
#include "ardrone_motor_control.h"
@@ -106,22 +107,19 @@ int ar_multiplexing_init()
fd = open(GPIO_DEVICE_PATH, 0);
if (fd < 0) {
printf("GPIO: open fail\n");
warn("GPIO: open fail");
return fd;
}
/* deactivate all outputs */
int ret = 0;
ret += ioctl(fd, GPIO_SET, motor_gpios);
if (ioctl(fd, GPIO_SET_OUTPUT, motor_gpios) != 0) {
printf("GPIO: output set fail\n");
if (ioctl(fd, GPIO_SET, motor_gpios)) {
warn("GPIO: clearing pins fail");
close(fd);
return -1;
}
if (ret < 0) {
printf("GPIO: clearing pins fail\n");
if (ioctl(fd, GPIO_SET_OUTPUT, motor_gpios) != 0) {
warn("GPIO: output set fail");
close(fd);
return -1;
}
+1 -1
View File
@@ -1374,7 +1374,7 @@ int mavlink_thread_main(int argc, char *argv[])
register_driver(MAVLINK_LOG_DEVICE, &mavlink_fops, 0666, NULL);
/* default values for arguments */
char *uart_name = "/dev/ttyS0";
char *uart_name = "/dev/ttyS1";
int baudrate = 57600;
/* read program arguments */
@@ -191,6 +191,7 @@ mc_thread_main(int argc, char *argv[])
close(manual_sub);
close(actuator_pub);
close(armed_pub);
close(att_sp_pub);
perf_print_counter(mc_loop_perf);
perf_free(mc_loop_perf);