MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / _io_thread

Method _io_thread

libraries/AP_HAL_ChibiOS/Scheduler.cpp:556–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556void Scheduler::_io_thread(void* arg)
557{
558 Scheduler *sched = (Scheduler *)arg;
559 chRegSetThreadName("io");
560 while (!sched->_hal_initialized) {
561 sched->delay_microseconds(1000);
562 }
563#if HAL_LOGGING_ENABLED
564 uint32_t last_sd_start_ms = AP_HAL::millis();
565#endif
566#if CH_DBG_ENABLE_STACK_CHECK == TRUE
567 uint32_t last_stack_check_ms = 0;
568#endif
569 while (true) {
570 sched->delay_microseconds(1000);
571
572 // run registered IO processes
573 sched->_run_io();
574
575#if HAL_LOGGING_ENABLED || CH_DBG_ENABLE_STACK_CHECK == TRUE
576 uint32_t now = AP_HAL::millis();
577#endif
578
579#if HAL_LOGGING_ENABLED
580 if (!hal.util->get_soft_armed()) {
581 // if sdcard hasn't mounted then retry it every 3s in the IO
582 // thread when disarmed
583 if (now - last_sd_start_ms > 3000) {
584 last_sd_start_ms = now;
585 AP::FS().retry_mount();
586 }
587 }
588#endif
589#if CH_DBG_ENABLE_STACK_CHECK == TRUE
590 if (now - last_stack_check_ms > 1000) {
591 last_stack_check_ms = now;
592 sched->check_stack_free();
593 }
594#endif
595 }
596}
597
598#if defined(STM32H7)
599/*

Callers

nothing calls this directly

Calls 6

get_soft_armedMethod · 0.80
check_stack_freeMethod · 0.80
millisFunction · 0.70
delay_microsecondsMethod · 0.45
_run_ioMethod · 0.45
retry_mountMethod · 0.45

Tested by

no test coverage detected