mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 05:13:35 +08:00
Merged beta into master
This commit is contained in:
@@ -203,7 +203,7 @@ int AttitudeEstimatorQ::start() {
|
||||
_control_task = px4_task_spawn_cmd("attitude_estimator_q",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2500,
|
||||
2000,
|
||||
(px4_main_t)&AttitudeEstimatorQ::task_main_trampoline,
|
||||
nullptr);
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ int commander_main(int argc, char *argv[])
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
|
||||
if (thread_running) {
|
||||
warnx("commander already running");
|
||||
warnx("already running");
|
||||
/* this is not an error */
|
||||
return 0;
|
||||
}
|
||||
@@ -294,11 +294,18 @@ int commander_main(int argc, char *argv[])
|
||||
commander_thread_main,
|
||||
(argv) ? (char * const *)&argv[2] : (char * const *)NULL);
|
||||
|
||||
while (!thread_running) {
|
||||
usleep(200);
|
||||
unsigned constexpr max_wait_us = 1000000;
|
||||
unsigned constexpr max_wait_steps = 2000;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < max_wait_steps; i++) {
|
||||
usleep(max_wait_us / max_wait_steps);
|
||||
if (thread_running) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return !(i < max_wait_steps);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "stop")) {
|
||||
|
||||
@@ -1960,6 +1960,12 @@ Mavlink::start(int argc, char *argv[])
|
||||
// before returning to the shell
|
||||
int ic = Mavlink::instance_count();
|
||||
|
||||
if (ic == MAVLINK_COMM_NUM_BUFFERS) {
|
||||
warnx("Maximum MAVLink instance count of %d reached.",
|
||||
(int)MAVLINK_COMM_NUM_BUFFERS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Instantiate thread
|
||||
char buf[24];
|
||||
sprintf(buf, "mavlink_if%d", ic);
|
||||
|
||||
@@ -54,6 +54,6 @@ MAXOPTIMIZATION = -Os
|
||||
|
||||
MODULE_STACKSIZE = 1200
|
||||
|
||||
EXTRACXXFLAGS = -Weffc++ -Wno-attributes -Wno-packed
|
||||
EXTRACXXFLAGS = -Weffc++ -Wno-attributes -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3
|
||||
|
||||
EXTRACFLAGS = -Wno-packed
|
||||
EXTRACFLAGS = -Wno-packed -DMAVLINK_COMM_NUM_BUFFERS=3
|
||||
|
||||
@@ -346,7 +346,20 @@ int sdlog2_main(int argc, char *argv[])
|
||||
3000,
|
||||
sdlog2_thread_main,
|
||||
(char * const *)argv);
|
||||
return 0;
|
||||
|
||||
/* wait for the task to launch */
|
||||
unsigned const max_wait_us = 1000000;
|
||||
unsigned const max_wait_steps = 2000;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < max_wait_steps; i++) {
|
||||
usleep(max_wait_us / max_wait_steps);
|
||||
if (thread_running) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return !(i < max_wait_steps);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "stop")) {
|
||||
@@ -1236,8 +1249,6 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||
/* close stdout */
|
||||
close(1);
|
||||
|
||||
thread_running = true;
|
||||
|
||||
/* initialize thread synchronization */
|
||||
pthread_mutex_init(&logbuffer_mutex, NULL);
|
||||
pthread_cond_init(&logbuffer_cond, NULL);
|
||||
@@ -1271,6 +1282,9 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||
sdlog2_start_log();
|
||||
}
|
||||
|
||||
/* running, report */
|
||||
thread_running = true;
|
||||
|
||||
while (!main_thread_should_exit) {
|
||||
usleep(sleep_delay);
|
||||
|
||||
|
||||
@@ -80,8 +80,6 @@ void cpuload_initialize_once()
|
||||
system_load.tasks[i].valid = false;
|
||||
}
|
||||
|
||||
uint64_t now = hrt_absolute_time();
|
||||
|
||||
int static_tasks_count = 2; // there are at least 2 threads that should be initialized statically - "idle" and "init"
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
@@ -96,7 +94,6 @@ void cpuload_initialize_once()
|
||||
|
||||
// perform static initialization of "system" threads
|
||||
for (system_load.total_count = 0; system_load.total_count < static_tasks_count; system_load.total_count++) {
|
||||
system_load.tasks[system_load.total_count].start_time = now;
|
||||
system_load.tasks[system_load.total_count].total_runtime = 0;
|
||||
system_load.tasks[system_load.total_count].curr_start_time = 0;
|
||||
system_load.tasks[system_load.total_count].tcb = sched_gettcb(
|
||||
@@ -113,7 +110,6 @@ void sched_note_start(FAR struct tcb_s *tcb)
|
||||
for (i = 1; i < CONFIG_MAX_TASKS; i++) {
|
||||
if (!system_load.tasks[i].valid) {
|
||||
/* slot is available */
|
||||
system_load.tasks[i].start_time = hrt_absolute_time();
|
||||
system_load.tasks[i].total_runtime = 0;
|
||||
system_load.tasks[i].curr_start_time = 0;
|
||||
system_load.tasks[i].tcb = tcb;
|
||||
|
||||
@@ -42,7 +42,6 @@ __BEGIN_DECLS
|
||||
struct system_load_taskinfo_s {
|
||||
uint64_t total_runtime; ///< Runtime since start (start_time - total_runtime)/(start_time - current_time) = load
|
||||
uint64_t curr_start_time; ///< Start time of the current scheduling slot
|
||||
uint64_t start_time; ///< FIRST start time of task
|
||||
#ifdef __PX4_NUTTX
|
||||
FAR struct tcb_s *tcb; ///<
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user