mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 08:30:34 +08:00
Teached the FMU driver that stopping is also an option
This commit is contained in:
@@ -1093,6 +1093,20 @@ fmu_start(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
fmu_stop(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
if (g_fmu != nullptr) {
|
||||
|
||||
delete g_fmu;
|
||||
g_fmu = nullptr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
test(void)
|
||||
{
|
||||
@@ -1224,6 +1238,12 @@ fmu_main(int argc, char *argv[])
|
||||
PortMode new_mode = PORT_MODE_UNSET;
|
||||
const char *verb = argv[1];
|
||||
|
||||
if (!strcmp(verb, "stop")) {
|
||||
fmu_stop();
|
||||
errx(0, "FMU driver stopped");
|
||||
}
|
||||
|
||||
|
||||
if (fmu_start() != OK)
|
||||
errx(1, "failed to start the FMU driver");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user