/** * Main entry point for this module **/ int land_detector_main(int argc, char *argv[]) { if (argc < 2) { goto exiterr; } if (argc >= 2 && !strcmp(argv[1], "start")) { if (land_detector_start(argv[2]) != 0) { warnx("land_detector start failed"); return 1; } return 0; } if (!strcmp(argv[1], "stop")) { land_detector_stop(); return 0; } if (!strcmp(argv[1], "status")) { if (land_detector_task) { if (land_detector_task->isRunning()) { warnx("running (%s): %s", _currentMode, (land_detector_task->isLanded()) ? "LANDED" : "IN AIR"); } else { warnx("exists, but not running (%s)", _currentMode); } return 0; } else { warnx("not running"); return 1; } } exiterr: warnx("usage: land_detector {start|stop|status} [mode]"); warnx("mode can either be 'fixedwing' or 'multicopter'"); return 1; }
/** * Main entry point for this module */ int land_detector_main(int argc, char *argv[]) { if (argc < 2) { goto exiterr; } if (argc >= 2 && !strcmp(argv[1], "start")) { if (land_detector_start(argv[2]) != 0) { PX4_WARN("land_detector start failed"); return 1; } return 0; } if (!strcmp(argv[1], "stop")) { land_detector_stop(); return 0; } if (!strcmp(argv[1], "status")) { if (land_detector_task) { if (land_detector_task->is_running()) { PX4_INFO("running (%s)", _currentMode); LandDetector::LandDetectionState state = land_detector_task->get_state(); switch (state) { case LandDetector::LandDetectionState::FLYING: PX4_INFO("State: Flying"); break; case LandDetector::LandDetectionState::LANDED: PX4_INFO("State: Landed"); break; case LandDetector::LandDetectionState::FREEFALL: PX4_INFO("State: Freefall"); break; default: PX4_ERR("State: unknown"); break; } } else { PX4_WARN("exists, but not running (%s)", _currentMode); } return 0; } else { PX4_WARN("not running"); return 1; } } exiterr: PX4_WARN("usage: land_detector {start|stop|status} [mode]"); PX4_WARN("mode can either be 'fixedwing' or 'multicopter'"); return 1; }