mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
minor changes for default options, closing properly all subscriptions in multirotor att control now on exit
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <drivers/drv_gpio.h>
|
#include <drivers/drv_gpio.h>
|
||||||
#include <arch/board/up_hrt.h>
|
#include <arch/board/up_hrt.h>
|
||||||
|
#include <systemlib/err.h>
|
||||||
|
|
||||||
#include "ardrone_motor_control.h"
|
#include "ardrone_motor_control.h"
|
||||||
|
|
||||||
@@ -106,22 +107,19 @@ int ar_multiplexing_init()
|
|||||||
fd = open(GPIO_DEVICE_PATH, 0);
|
fd = open(GPIO_DEVICE_PATH, 0);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
printf("GPIO: open fail\n");
|
warn("GPIO: open fail");
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deactivate all outputs */
|
/* deactivate all outputs */
|
||||||
int ret = 0;
|
if (ioctl(fd, GPIO_SET, motor_gpios)) {
|
||||||
ret += ioctl(fd, GPIO_SET, motor_gpios);
|
warn("GPIO: clearing pins fail");
|
||||||
|
|
||||||
if (ioctl(fd, GPIO_SET_OUTPUT, motor_gpios) != 0) {
|
|
||||||
printf("GPIO: output set fail\n");
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ioctl(fd, GPIO_SET_OUTPUT, motor_gpios) != 0) {
|
||||||
printf("GPIO: clearing pins fail\n");
|
warn("GPIO: output set fail");
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1374,7 +1374,7 @@ int mavlink_thread_main(int argc, char *argv[])
|
|||||||
register_driver(MAVLINK_LOG_DEVICE, &mavlink_fops, 0666, NULL);
|
register_driver(MAVLINK_LOG_DEVICE, &mavlink_fops, 0666, NULL);
|
||||||
|
|
||||||
/* default values for arguments */
|
/* default values for arguments */
|
||||||
char *uart_name = "/dev/ttyS0";
|
char *uart_name = "/dev/ttyS1";
|
||||||
int baudrate = 57600;
|
int baudrate = 57600;
|
||||||
|
|
||||||
/* read program arguments */
|
/* read program arguments */
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ mc_thread_main(int argc, char *argv[])
|
|||||||
close(manual_sub);
|
close(manual_sub);
|
||||||
close(actuator_pub);
|
close(actuator_pub);
|
||||||
close(armed_pub);
|
close(armed_pub);
|
||||||
|
close(att_sp_pub);
|
||||||
|
|
||||||
perf_print_counter(mc_loop_perf);
|
perf_print_counter(mc_loop_perf);
|
||||||
perf_free(mc_loop_perf);
|
perf_free(mc_loop_perf);
|
||||||
|
|||||||
Reference in New Issue
Block a user