|
|
|
@ -967,19 +967,6 @@ int commander_thread_main(int argc, char *argv[])
@@ -967,19 +967,6 @@ int commander_thread_main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
pthread_attr_t commander_low_prio_attr; |
|
|
|
|
pthread_attr_init(&commander_low_prio_attr); |
|
|
|
|
pthread_attr_setstacksize(&commander_low_prio_attr, 2000); |
|
|
|
|
|
|
|
|
|
struct sched_param param; |
|
|
|
|
(void)pthread_attr_getschedparam(&commander_low_prio_attr, ¶m); |
|
|
|
|
|
|
|
|
|
/* low priority */ |
|
|
|
|
param.sched_priority = SCHED_PRIORITY_DEFAULT - 50; |
|
|
|
|
(void)pthread_attr_setschedparam(&commander_low_prio_attr, ¶m); |
|
|
|
|
pthread_create(&commander_low_prio_thread, &commander_low_prio_attr, commander_low_prio_loop, NULL); |
|
|
|
|
pthread_attr_destroy(&commander_low_prio_attr); |
|
|
|
|
|
|
|
|
|
/* Start monitoring loop */ |
|
|
|
|
unsigned counter = 0; |
|
|
|
|
unsigned stick_off_counter = 0; |
|
|
|
@ -1144,6 +1131,20 @@ int commander_thread_main(int argc, char *argv[])
@@ -1144,6 +1131,20 @@ int commander_thread_main(int argc, char *argv[])
|
|
|
|
|
bool main_state_changed = false; |
|
|
|
|
bool failsafe_old = false; |
|
|
|
|
|
|
|
|
|
/* initialize low priority thread */ |
|
|
|
|
pthread_attr_t commander_low_prio_attr; |
|
|
|
|
pthread_attr_init(&commander_low_prio_attr); |
|
|
|
|
pthread_attr_setstacksize(&commander_low_prio_attr, 1600); |
|
|
|
|
|
|
|
|
|
struct sched_param param; |
|
|
|
|
(void)pthread_attr_getschedparam(&commander_low_prio_attr, ¶m); |
|
|
|
|
|
|
|
|
|
/* low priority */ |
|
|
|
|
param.sched_priority = SCHED_PRIORITY_DEFAULT - 50; |
|
|
|
|
(void)pthread_attr_setschedparam(&commander_low_prio_attr, ¶m); |
|
|
|
|
pthread_create(&commander_low_prio_thread, &commander_low_prio_attr, commander_low_prio_loop, NULL); |
|
|
|
|
pthread_attr_destroy(&commander_low_prio_attr); |
|
|
|
|
|
|
|
|
|
while (!thread_should_exit) { |
|
|
|
|
|
|
|
|
|
if (mavlink_fd < 0 && counter % (1000000 / MAVLINK_OPEN_INTERVAL) == 0) { |
|
|
|
|