Merge pull request #2230 from bansiesta/fix_startup_printfs

Cosmetic startup fixes
This commit is contained in:
Lorenz Meier
2015-05-26 23:02:56 -07:00
6 changed files with 36 additions and 32 deletions
@@ -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);
}
}
@@ -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
*/
@@ -1154,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);
}
@@ -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);
+3 -3
View File
@@ -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. */
@@ -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;
}