Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
preflight_checks.c File Reference
#include "preflight_checks.h"
#include "modules/datalink/telemetry.h"
#include "modules/loggers/flight_recorder.h"
#include <stdio.h>
+ Include dependency graph for preflight_checks.c:

Go to the source code of this file.

Macros

#define PREFLIGHT_CHECK_MAX_MSGBUF   1024
 Maximum combined message size for storing the errors. More...
 
#define PREFLIGHT_CHECK_SEPERATOR   ';'
 Seperating character for storing the errors. More...
 
#define PREFLIGHT_CHECK_INFO_TIMEOUT   5
 Only send messages down every xx amount of seconds. More...
 
#define PREFLIGHT_CHECK_GROUND   TRUE
 Enable ground based checklist. More...
 
#define PREFLIGHT_CHECK_BYPASS   FALSE
 Bypass the preflight checks. More...
 

Functions

void preflight_check_register (struct preflight_check_t *check, preflight_check_f func)
 Register a preflight check and add it to the linked list. More...
 
bool preflight_check (void)
 Perform all the preflight checks. More...
 
void preflight_error (struct preflight_result_t *result, const char *fmt,...)
 Register a preflight error used inside the preflight checking functions. More...
 
void preflight_warning (struct preflight_result_t *result, const char *fmt,...)
 Register a preflight warning used inside the preflight checking functions. More...
 
void preflight_success (struct preflight_result_t *result, const char *fmt,...)
 Register a preflight success used inside the preflight checking functions. More...
 
void preflight_checks_log_bypass (bool bypass)
 

Variables

bool preflight_bypass = PREFLIGHT_CHECK_BYPASS
 
bool preflight_ground_done = false
 
static struct preflight_check_tpreflight_head = NULL
 

Detailed Description

Author
Freek van Tienen freek.nosp@m..v.t.nosp@m.ienen.nosp@m.@gma.nosp@m.il.co.nosp@m.m Adds preflight checks for takeoff

Definition in file preflight_checks.c.

Macro Definition Documentation

◆ PREFLIGHT_CHECK_BYPASS

#define PREFLIGHT_CHECK_BYPASS   FALSE

Bypass the preflight checks.

Definition at line 54 of file preflight_checks.c.

◆ PREFLIGHT_CHECK_GROUND

#define PREFLIGHT_CHECK_GROUND   TRUE

Enable ground based checklist.

Definition at line 49 of file preflight_checks.c.

◆ PREFLIGHT_CHECK_INFO_TIMEOUT

#define PREFLIGHT_CHECK_INFO_TIMEOUT   5

Only send messages down every xx amount of seconds.

Definition at line 44 of file preflight_checks.c.

◆ PREFLIGHT_CHECK_MAX_MSGBUF

#define PREFLIGHT_CHECK_MAX_MSGBUF   1024

Maximum combined message size for storing the errors.

Definition at line 34 of file preflight_checks.c.

◆ PREFLIGHT_CHECK_SEPERATOR

#define PREFLIGHT_CHECK_SEPERATOR   ';'

Seperating character for storing the errors.

Definition at line 39 of file preflight_checks.c.

Function Documentation

◆ preflight_check()

bool preflight_check ( void  )

Perform all the preflight checks.

Returns
true When all preflight checks are successful
false When one or more preflight checks fail

Definition at line 83 of file preflight_checks.c.

References DefaultChannel, DefaultDevice, preflight_result_t::fail_cnt, preflight_check_t::func, get_sys_time_float(), preflight_result_t::max_len, preflight_result_t::message, preflight_check_t::next, pprzlog_tp, PREFLIGHT_CHECK_INFO_TIMEOUT, PREFLIGHT_CHECK_MAX_MSGBUF, PREFLIGHT_CHECK_SEPERATOR, preflight_error(), preflight_ground_done, preflight_head, preflight_success(), preflight_result_t::success_cnt, and preflight_result_t::warning_cnt.

Referenced by autopilot_arming_motors_on(), and autopilot_set_motors_on().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preflight_check_register()

void preflight_check_register ( struct preflight_check_t check,
preflight_check_f  func 
)

Register a preflight check and add it to the linked list.

Parameters
checkThe check to add containing a linked list
funcThe function to register for the check

Definition at line 68 of file preflight_checks.c.

References preflight_check_t::func, preflight_check_t::next, and preflight_head.

Referenced by agl_dist_init(), electrical_init(), gps_init(), imu_heater_init(), ms45xx_i2c_init(), pfc_actuators_init(), sdlog_chibios_init(), and stateInit().

+ Here is the caller graph for this function:

◆ preflight_checks_log_bypass()

void preflight_checks_log_bypass ( bool  bypass)

Definition at line 263 of file preflight_checks.c.

References DefaultChannel, DefaultDevice, msg, pprzlog_tp, and preflight_bypass.

◆ preflight_error()

void preflight_error ( struct preflight_result_t result,
const char *  fmt,
  ... 
)

Register a preflight error used inside the preflight checking functions.

Parameters
resultWhere the error gets registered
fmtA formatted string describing the error used in a vsnprintf
...The arguments for the vsnprintf

Definition at line 173 of file preflight_checks.c.

References preflight_result_t::fail_cnt, preflight_result_t::max_len, preflight_result_t::message, and PREFLIGHT_CHECK_SEPERATOR.

Referenced by pfc_actuators_cb(), and preflight_check().

+ Here is the caller graph for this function:

◆ preflight_success()

void preflight_success ( struct preflight_result_t result,
const char *  fmt,
  ... 
)

Register a preflight success used inside the preflight checking functions.

Parameters
result
<strong>attribute</strong>
...

Definition at line 257 of file preflight_checks.c.

References preflight_result_t::success_cnt.

Referenced by pfc_actuators_cb(), and preflight_check().

+ Here is the caller graph for this function:

◆ preflight_warning()

void preflight_warning ( struct preflight_result_t result,
const char *  fmt,
  ... 
)

Register a preflight warning used inside the preflight checking functions.

Parameters
resultWhere the error gets registered
fmtA formatted string describing the error used in a vsnprintf
...The arguments for the vsnprintf

Definition at line 215 of file preflight_checks.c.

References preflight_result_t::max_len, preflight_result_t::message, PREFLIGHT_CHECK_SEPERATOR, and preflight_result_t::warning_cnt.

Variable Documentation

◆ preflight_bypass

◆ preflight_ground_done

bool preflight_ground_done = false

Definition at line 58 of file preflight_checks.c.

Referenced by preflight_check().

◆ preflight_head

struct preflight_check_t* preflight_head = NULL
static

Definition at line 60 of file preflight_checks.c.

Referenced by preflight_check(), and preflight_check_register().