mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-08 11:40:34 +08:00
astyle shift module documentation to bottom of files
- Astyle chokes on the module description strings, so for now we can keep them near the bottom of each file.
This commit is contained in:
@@ -953,6 +953,84 @@ Replay::custom_command(int argc, char *argv[])
|
||||
return print_usage("unknown command");
|
||||
}
|
||||
|
||||
int
|
||||
Replay::task_spawn(int argc, char *argv[])
|
||||
{
|
||||
// check if a log file was found
|
||||
if (!isSetup()) {
|
||||
if (argc > 0 && strncmp(argv[0], "try", 3) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PX4_ERR("no log file given (via env variable %s)", replay::ENV_FILENAME);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_task_id = px4_task_spawn_cmd("replay",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
4000,
|
||||
(px4_main_t)&run_trampoline,
|
||||
(char *const *)argv);
|
||||
|
||||
if (_task_id < 0) {
|
||||
_task_id = -1;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Replay::applyParams(bool quiet)
|
||||
{
|
||||
if (!isSetup()) {
|
||||
if (quiet) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PX4_ERR("no log file given (via env variable %s)", replay::ENV_FILENAME);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
Replay *r = new Replay();
|
||||
|
||||
if (r == nullptr) {
|
||||
PX4_ERR("alloc failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ifstream replay_file(_replay_file, ios::in | ios::binary);
|
||||
|
||||
if (!r->readDefinitionsAndApplyParams(replay_file)) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
delete r;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Replay *
|
||||
Replay::instantiate(int argc, char *argv[])
|
||||
{
|
||||
// check the replay mode
|
||||
const char *replay_mode = getenv(replay::ENV_MODE);
|
||||
|
||||
Replay *instance = nullptr;
|
||||
|
||||
if (replay_mode && strcmp(replay_mode, "ekf2") == 0) {
|
||||
PX4_INFO("Ekf2 replay mode");
|
||||
instance = new ReplayEkf2();
|
||||
|
||||
} else {
|
||||
instance = new Replay();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
int
|
||||
Replay::print_usage(const char *reason)
|
||||
{
|
||||
@@ -989,79 +1067,4 @@ page.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Replay::task_spawn(int argc, char *argv[])
|
||||
{
|
||||
// check if a log file was found
|
||||
if (!isSetup()) {
|
||||
if (argc > 0 && strncmp(argv[0], "try", 3)==0) {
|
||||
return 0;
|
||||
}
|
||||
PX4_ERR("no log file given (via env variable %s)", replay::ENV_FILENAME);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_task_id = px4_task_spawn_cmd("replay",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
4000,
|
||||
(px4_main_t)&run_trampoline,
|
||||
(char *const *)argv);
|
||||
|
||||
if (_task_id < 0) {
|
||||
_task_id = -1;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Replay::applyParams(bool quiet)
|
||||
{
|
||||
if (!isSetup()) {
|
||||
if (quiet) {
|
||||
return 0;
|
||||
}
|
||||
PX4_ERR("no log file given (via env variable %s)", replay::ENV_FILENAME);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
Replay *r = new Replay();
|
||||
|
||||
if (r == nullptr) {
|
||||
PX4_ERR("alloc failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ifstream replay_file(_replay_file, ios::in | ios::binary);
|
||||
|
||||
if (!r->readDefinitionsAndApplyParams(replay_file)) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
delete r;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Replay *
|
||||
Replay::instantiate(int argc, char *argv[])
|
||||
{
|
||||
// check the replay mode
|
||||
const char *replay_mode = getenv(replay::ENV_MODE);
|
||||
|
||||
Replay *instance = nullptr;
|
||||
if (replay_mode && strcmp(replay_mode, "ekf2") == 0) {
|
||||
PX4_INFO("Ekf2 replay mode");
|
||||
instance = new ReplayEkf2();
|
||||
|
||||
} else {
|
||||
instance = new Replay();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
} //namespace px4
|
||||
|
||||
Reference in New Issue
Block a user