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

Method init

libraries/AP_BoardConfig/AP_BoardConfig.cpp:404–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402};
403
404void AP_BoardConfig::init()
405{
406 // PARAMETER_CONVERSION - Added: APR-2022
407 vehicleSerialNumber.convert_parameter_width(AP_PARAM_INT16);
408
409 board_setup();
410
411#if AP_RTC_ENABLED
412 AP::rtc().set_utc_usec(hal.util->get_hw_rtc(), AP_RTC::SOURCE_HW);
413#endif
414
415 if (_boot_delay_ms > 0) {
416 uint16_t delay_ms = uint16_t(_boot_delay_ms.get());
417 if (hal.util->was_watchdog_armed() && delay_ms > 200) {
418 // don't delay a long time on watchdog reset, the pilot
419 // may be able to save the vehicle
420 delay_ms = 200;
421 }
422 hal.scheduler->delay(delay_ms);
423 }
424
425#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS && defined(USE_POSIX)
426 uint8_t slowdown = constrain_int16(_sdcard_slowdown.get(), 0, 32);
427 const uint8_t max_slowdown = 8;
428 do {
429 if (AP::FS().retry_mount()) {
430 break;
431 }
432 slowdown++;
433 hal.scheduler->delay(5);
434 } while (slowdown < max_slowdown);
435 if (slowdown < max_slowdown) {
436 _sdcard_slowdown.set(slowdown);
437 } else {
438 printf("SDCard failed to start\n");
439 }
440#endif
441}
442
443// set default value for BRD_SAFETY_MASK
444void AP_BoardConfig::set_default_safety_ignore_mask(uint32_t mask)

Callers 1

board_setupMethod · 0.45

Calls 9

constrain_int16Function · 0.85
set_utc_usecMethod · 0.80
was_watchdog_armedMethod · 0.80
get_hw_rtcMethod · 0.45
getMethod · 0.45
delayMethod · 0.45
retry_mountMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected