From 40e9c83ed6cc7c99499c4a4b59e118394399495b Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 18:28:27 +0100 Subject: [PATCH 1/9] mavlink: no need to shout about disabling hardware flow control --- src/modules/mavlink/mavlink_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index b12003447a..9f5a11f94b 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -777,7 +777,7 @@ Mavlink::get_free_tx_buf() if (_last_write_try_time != 0 && hrt_elapsed_time(&_last_write_success_time) > 500 * 1000UL && _last_write_success_time != _last_write_try_time) { - warnx("DISABLING HARDWARE FLOW CONTROL"); + warnx("Disabling hardware flow control"); enable_flow_control(false); } } @@ -913,7 +913,7 @@ Mavlink::handle_message(const mavlink_message_t *msg) /* handle packet with parameter component */ _parameters_manager->handle_message(msg); - + /* handle packet with ftp component */ _mavlink_ftp->handle_message(msg); @@ -1468,7 +1468,7 @@ Mavlink::task_main(int argc, char *argv[]) _mavlink_ftp = (MavlinkFTP *) MavlinkFTP::new_instance(this); _mavlink_ftp->set_interval(interval_from_rate(80.0f)); LL_APPEND(_streams, _mavlink_ftp); - + /* MISSION_STREAM stream, actually sends all MISSION_XXX messages at some rate depending on * remote requests rate. Rate specified here controls how much bandwidth we will reserve for * mission messages. */ From 198fa8d5421c95a78b438703932993cf3660aa9c Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 18:32:32 +0100 Subject: [PATCH 2/9] px4_getopt: commented out debug printf --- src/platforms/common/px4_getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/common/px4_getopt.c b/src/platforms/common/px4_getopt.c index 5f76065bb0..d4b6c10e40 100644 --- a/src/platforms/common/px4_getopt.c +++ b/src/platforms/common/px4_getopt.c @@ -73,7 +73,7 @@ static int reorder(int argc, char **argv, const char *options) tmpidx++; if (takesarg) { tmp_argv[tmpidx] = argv[idx+1]; - printf("tmp_argv[%d] = %s\n", tmpidx, tmp_argv[tmpidx]); + // printf("tmp_argv[%d] = %s\n", tmpidx, tmp_argv[tmpidx]); tmpidx++; idx++; } From 165063d5fc4046a11dac55d16334fe6e882ee8e7 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 18:32:55 +0100 Subject: [PATCH 3/9] px4_getopt: whitespace --- src/platforms/common/px4_getopt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/common/px4_getopt.c b/src/platforms/common/px4_getopt.c index d4b6c10e40..d7d03ed49f 100644 --- a/src/platforms/common/px4_getopt.c +++ b/src/platforms/common/px4_getopt.c @@ -108,11 +108,11 @@ static int reorder(int argc, char **argv, const char *options) } // -// px4_getopt +// px4_getopt // // returns: // the valid option character -// '?' if any option is unknown +// '?' if any option is unknown // -1 if no remaining options // // If the option takes an arg, myoptarg will be updated accordingly. From 414f3330b34e81d1585bb57f9b41b3e17b43eeed Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 18:34:31 +0100 Subject: [PATCH 4/9] px4flow: tell the user which PX4FLOW couldn't be connected --- src/drivers/px4flow/px4flow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/px4flow/px4flow.cpp b/src/drivers/px4flow/px4flow.cpp index 4d87d1cfe1..db721afe32 100644 --- a/src/drivers/px4flow/px4flow.cpp +++ b/src/drivers/px4flow/px4flow.cpp @@ -714,7 +714,7 @@ fail: g_dev = nullptr; } - errx(1, "no PX4 FLOW connected"); + errx(1, "no PX4FLOW connected over I2C"); } /** From 87f41855fbbe14d09db22200f0f14831970533a1 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 19:01:34 +0100 Subject: [PATCH 5/9] land_detector: get rid of one dot at a time --- .../land_detector/land_detector_main.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/modules/land_detector/land_detector_main.cpp b/src/modules/land_detector/land_detector_main.cpp index 09b5fd799b..82f890b5f7 100644 --- a/src/modules/land_detector/land_detector_main.cpp +++ b/src/modules/land_detector/land_detector_main.cpp @@ -151,20 +151,26 @@ static int land_detector_start(const char *mode) /* avoid memory fragmentation by not exiting start handler until the task has fully started */ const uint32_t timeout = hrt_absolute_time() + 5000000; //5 second timeout - while (!land_detector_task->isRunning()) { - usleep(50000); - printf("."); - fflush(stdout); + /* avoid printing dots just yet and do one sleep before the first check */ + usleep(10000); - if (hrt_absolute_time() > timeout) { - err(1, "start failed - timeout"); - land_detector_stop(); - exit(1); + /* check if the waiting involving dots and a newline are still needed */ + if (!land_detector_task->isRunning()) { + while (!land_detector_task->isRunning()) { + + printf("."); + fflush(stdout); + usleep(50000); + + if (hrt_absolute_time() > timeout) { + err(1, "start failed - timeout"); + land_detector_stop(); + exit(1); + } } + printf("\n"); } - printf("\n"); - //Remember current active mode strncpy(_currentMode, mode, 12); From c56a9ce9651d806ab1fdc21daf6a36c0b32734f3 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 19:08:51 +0100 Subject: [PATCH 6/9] position_estimator_inav: be a bit more informative about this ominous offs --- .../position_estimator_inav/position_estimator_inav_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/position_estimator_inav/position_estimator_inav_main.c b/src/modules/position_estimator_inav/position_estimator_inav_main.c index 5660bcc194..9dc7999099 100644 --- a/src/modules/position_estimator_inav/position_estimator_inav_main.c +++ b/src/modules/position_estimator_inav/position_estimator_inav_main.c @@ -389,8 +389,8 @@ int position_estimator_inav_thread_main(int argc, char *argv[]) } else { wait_baro = false; baro_offset /= (float) baro_init_cnt; - warnx("baro offs: %d", (int)baro_offset); - mavlink_log_info(mavlink_fd, "[inav] baro offs: %d", (int)baro_offset); + warnx("baro offset: %d m", (int)baro_offset); + mavlink_log_info(mavlink_fd, "[inav] baro offset: %d m", (int)baro_offset); local_pos.z_valid = true; local_pos.v_z_valid = true; } From 38412993d64c4b6012cd2aeb27cd8a93c08780da Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 19:09:28 +0100 Subject: [PATCH 7/9] fw_att_control: don't brag about being running --- src/modules/fw_att_control/fw_att_control_main.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp index fb6f74f357..c5a4ea6d15 100644 --- a/src/modules/fw_att_control/fw_att_control_main.cpp +++ b/src/modules/fw_att_control/fw_att_control_main.cpp @@ -619,11 +619,6 @@ FixedwingAttitudeControl::task_main_trampoline(int argc, char *argv[]) void FixedwingAttitudeControl::task_main() { - - /* inform about start */ - warnx("Initializing.."); - fflush(stdout); - /* * do subscriptions */ From d36b65aab5f1676756129be59ce0efc4fa30e7f8 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 19:09:45 +0100 Subject: [PATCH 8/9] fw_att_control: whitespace --- src/modules/fw_att_control/fw_att_control_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp index c5a4ea6d15..d707449995 100644 --- a/src/modules/fw_att_control/fw_att_control_main.cpp +++ b/src/modules/fw_att_control/fw_att_control_main.cpp @@ -520,7 +520,7 @@ FixedwingAttitudeControl::vehicle_control_mode_poll() orb_check(_vcontrol_mode_sub, &vcontrol_mode_updated); if (vcontrol_mode_updated) { - + orb_copy(ORB_ID(vehicle_control_mode), _vcontrol_mode_sub, &_vcontrol_mode); } } From 4cf8ce30ba0523a81e1237c7970dfa22c52c1a39 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Mon, 25 May 2015 19:10:05 +0100 Subject: [PATCH 9/9] fw_att_control: another ugly way to prevent a newline --- .../fw_att_control/fw_att_control_main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp index d707449995..cb17728948 100644 --- a/src/modules/fw_att_control/fw_att_control_main.cpp +++ b/src/modules/fw_att_control/fw_att_control_main.cpp @@ -1149,14 +1149,17 @@ int fw_att_control_main(int argc, char *argv[]) err(1, "start failed"); } - /* avoid memory fragmentation by not exiting start handler until the task has fully started */ - while (att_control::g_control == nullptr || !att_control::g_control->task_running()) { - usleep(50000); - printf("."); - fflush(stdout); - } - printf("\n"); + /* check if the waiting is necessary at all */ + if (att_control::g_control == nullptr || !att_control::g_control->task_running()) { + /* avoid memory fragmentation by not exiting start handler until the task has fully started */ + while (att_control::g_control == nullptr || !att_control::g_control->task_running()) { + usleep(50000); + printf("."); + fflush(stdout); + } + printf("\n"); + } exit(0); }