forked from Archive/PX4-Autopilot
px4fmu-v4: Only close down fmu drivers on reset if they weren't running
Signed-off-by: zthorson <zachthorson@gmail.com>
This commit is contained in:
parent
63857c6afc
commit
a716b105f5
|
@ -3273,6 +3273,7 @@ fmu_main(int argc, char *argv[])
|
|||
{
|
||||
PortMode new_mode = PORT_MODE_UNSET;
|
||||
const char *verb = argv[1];
|
||||
bool fmu_was_running = false;
|
||||
|
||||
if (!strcmp(verb, "bind")) {
|
||||
bind_spektrum();
|
||||
|
@ -3302,6 +3303,8 @@ fmu_main(int argc, char *argv[])
|
|||
errx(0, "FMU driver stopped");
|
||||
}
|
||||
|
||||
fmu_was_running = (g_fmu != nullptr);
|
||||
|
||||
if (fmu_start() != OK) {
|
||||
errx(1, "failed to start the FMU driver");
|
||||
}
|
||||
|
@ -3396,10 +3399,12 @@ fmu_main(int argc, char *argv[])
|
|||
warnx("resettet default time");
|
||||
}
|
||||
|
||||
// When we are done resetting, we should clean up the fmu drivers
|
||||
// Failure to do so prevents other devices (HIL sim driver)
|
||||
// from starting.
|
||||
fmu_stop();
|
||||
// When we are done resetting, we should clean up the fmu drivers if they
|
||||
// weren't active at the beginning of the reset.
|
||||
// Failure to do so prevents other devices (HIL sim driver) from starting
|
||||
if (!fmu_was_running) {
|
||||
fmu_stop();
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -3413,10 +3418,12 @@ fmu_main(int argc, char *argv[])
|
|||
warnx("resettet default time");
|
||||
}
|
||||
|
||||
// When we are done resetting, we should clean up the fmu drivers
|
||||
// Failure to do so prevents other devices (HIL sim driver)
|
||||
// from starting.
|
||||
fmu_stop();
|
||||
// When we are done resetting, we should clean up the fmu drivers if they
|
||||
// weren't active at the beginning of the reset.
|
||||
// Failure to do so prevents other devices (HIL sim driver) from starting
|
||||
if (!fmu_was_running) {
|
||||
fmu_stop();
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue