mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Don't leave RX in bind mode on console open fail
Don't leave RX in bind mode in the unlikely eventuality that console open fails
This commit is contained in:
@@ -1696,8 +1696,6 @@ bind(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
errx(1, "unknown parameter %s, use dsm2 or dsmx", argv[2]);
|
errx(1, "unknown parameter %s, use dsm2 or dsmx", argv[2]);
|
||||||
|
|
||||||
g_dev->ioctl(nullptr, DSM_BIND_START, pulses);
|
|
||||||
|
|
||||||
/* Open console directly to grab CTRL-C signal */
|
/* Open console directly to grab CTRL-C signal */
|
||||||
int console = open("/dev/console", O_NONBLOCK | O_RDONLY | O_NOCTTY);
|
int console = open("/dev/console", O_NONBLOCK | O_RDONLY | O_NOCTTY);
|
||||||
if (!console)
|
if (!console)
|
||||||
@@ -1706,6 +1704,8 @@ bind(int argc, char *argv[])
|
|||||||
warnx("This command will only bind DSM if satellite VCC (red wire) is controlled by relay 1.");
|
warnx("This command will only bind DSM if satellite VCC (red wire) is controlled by relay 1.");
|
||||||
warnx("Press CTRL-C or 'c' when done.");
|
warnx("Press CTRL-C or 'c' when done.");
|
||||||
|
|
||||||
|
g_dev->ioctl(nullptr, DSM_BIND_START, pulses);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
usleep(500000L);
|
usleep(500000L);
|
||||||
/* Check if user wants to quit */
|
/* Check if user wants to quit */
|
||||||
|
|||||||
Reference in New Issue
Block a user