From 35efe651ac63fa0dfa8ab5c0291fb96efc587131 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 29 Jan 2017 11:39:33 +0100 Subject: [PATCH] Land detector main: Fix style --- .../land_detector/land_detector_main.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/modules/land_detector/land_detector_main.cpp b/src/modules/land_detector/land_detector_main.cpp index 65f901f655..bafc68912b 100644 --- a/src/modules/land_detector/land_detector_main.cpp +++ b/src/modules/land_detector/land_detector_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2015 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2017 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,6 +36,7 @@ * Land detection algorithm * * @author Johan Jansen + * @author Lorenz Meier */ #include @@ -59,7 +60,7 @@ namespace land_detector { -//Function prototypes +// Function prototypes static int land_detector_start(const char *mode); static void land_detector_stop(); @@ -70,13 +71,13 @@ static void land_detector_stop(); */ extern "C" __EXPORT int land_detector_main(int argc, char *argv[]); -//Private variables +// Private variables static LandDetector *land_detector_task = nullptr; static char _currentMode[12]; /** -* Stop the task, force killing it if it doesn't stop by itself -**/ + * Stop the task, force killing it if it doesn't stop by itself + */ static void land_detector_stop() { if (land_detector_task == nullptr) { @@ -90,7 +91,7 @@ static void land_detector_stop() int i = 0; do { - /* wait 20ms */ + // wait 20ms at a time usleep(20000); } while (land_detector_task->is_running() && ++i < 50); @@ -102,8 +103,8 @@ static void land_detector_stop() } /** -* Start new task, fails if it is already running. Returns OK if successful -**/ + * Start new task, fails if it is already running. Returns OK if successful + */ static int land_detector_start(const char *mode) { if (land_detector_task != nullptr) { @@ -126,13 +127,13 @@ static int land_detector_start(const char *mode) return -1; } - //Check if alloc worked + // Check if alloc worked if (land_detector_task == nullptr) { PX4_WARN("alloc failed"); return -1; } - //Start new thread task + // Start new thread task int ret = land_detector_task->start(); if (ret) { @@ -140,13 +141,12 @@ static int land_detector_start(const char *mode) return -1; } - /* avoid memory fragmentation by not exiting start handler until the task has fully started */ - const uint64_t timeout = hrt_absolute_time() + 5000000; //5 second timeout + // Avoid memory fragmentation by not exiting start handler until the task has fully started + const uint64_t timeout = hrt_absolute_time() + 5000000; // 5 second timeout - /* avoid printing dots just yet and do one sleep before the first check */ + // Do one sleep before the first check usleep(10000); - /* check if the waiting involving dots and a newline are still needed */ if (!land_detector_task->is_running()) { while (!land_detector_task->is_running()) { usleep(50000); @@ -167,8 +167,8 @@ static int land_detector_start(const char *mode) } /** -* Main entry point for this module -**/ + * Main entry point for this module + */ int land_detector_main(int argc, char *argv[]) {