mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 09:58:23 +08:00
[pfc] Add ground checklists (#3276)
This commit is contained in:
@@ -269,16 +269,16 @@ static void pfc_actuators_cb(struct preflight_result_t *result)
|
||||
{
|
||||
switch(pfc_actuators.state) {
|
||||
case PFC_ACTUATORS_STATE_INIT:
|
||||
preflight_error(result, "Actuators not checked perform checks first[%d]", pfc_actuators.act_nb);
|
||||
preflight_error(result, "Actuators not checked [act: %d]", pfc_actuators.act_nb);
|
||||
break;
|
||||
case PFC_ACTUATORS_STATE_RUNNING:
|
||||
preflight_error(result, "Actuators are currently being checked[%d/%d]",pfc_actuators.act_idx, pfc_actuators.act_nb);
|
||||
preflight_error(result, "Actuators are currently being checked [act: %d/%d]",pfc_actuators.act_idx, pfc_actuators.act_nb);
|
||||
break;
|
||||
case PFC_ACTUATORS_STATE_SUCCESS:
|
||||
preflight_success(result, "Actuators checked and moved succesfully[%d]", pfc_actuators.act_nb);
|
||||
preflight_success(result, "Actuators checked and succesfull [act: %d]", pfc_actuators.act_nb);
|
||||
break;
|
||||
case PFC_ACTUATORS_STATE_ERROR:
|
||||
preflight_error(result, "Actuators not responding correctly[%d/%d]",pfc_actuators.act_idx, pfc_actuators.act_nb);
|
||||
preflight_error(result, "Actuators not responding correctly [act: %d/%d]",pfc_actuators.act_idx, pfc_actuators.act_nb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,18 @@
|
||||
#define PREFLIGHT_CHECK_INFO_TIMEOUT 5
|
||||
#endif
|
||||
|
||||
/** Enable ground based checklist */
|
||||
#ifndef PREFLIGHT_CHECK_GROUND
|
||||
#define PREFLIGHT_CHECK_GROUND TRUE
|
||||
#endif
|
||||
|
||||
/** Bypass the preflight checks */
|
||||
#ifndef PREFLIGHT_CHECK_BYPASS
|
||||
#define PREFLIGHT_CHECK_BYPASS FALSE
|
||||
#endif
|
||||
|
||||
bool preflight_bypass = PREFLIGHT_CHECK_BYPASS;
|
||||
bool preflight_ground_done = false;
|
||||
|
||||
static struct preflight_check_t *preflight_head = NULL;
|
||||
|
||||
@@ -92,6 +99,15 @@ bool preflight_check(void)
|
||||
check = check->next;
|
||||
}
|
||||
|
||||
// Add the ground check
|
||||
#if PREFLIGHT_CHECK_GROUND
|
||||
if (!preflight_ground_done) {
|
||||
preflight_error(&result, "Ground checks not done");
|
||||
} else {
|
||||
preflight_success(&result, "Ground checks done");
|
||||
}
|
||||
#endif
|
||||
|
||||
// We failed a check or have a warning
|
||||
if (result.fail_cnt > 0 || result.warning_cnt > 0) {
|
||||
// Only send every xx amount of seconds
|
||||
@@ -183,7 +199,7 @@ void preflight_error(struct preflight_result_t *result, const char *fmt, ...)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register a preflight error used inside the preflight checking functions
|
||||
* @brief Register a preflight warning used inside the preflight checking functions
|
||||
*
|
||||
* @param result Where the error gets registered
|
||||
* @param fmt A formatted string describing the error used in a vsnprintf
|
||||
|
||||
@@ -46,6 +46,7 @@ struct preflight_check_t {
|
||||
};
|
||||
|
||||
extern bool preflight_bypass;
|
||||
extern bool preflight_ground_done;
|
||||
extern void preflight_check_register(struct preflight_check_t *check, preflight_check_f func);
|
||||
extern bool preflight_check(void);
|
||||
extern void preflight_error(struct preflight_result_t *result, const char *fmt, ...);
|
||||
|
||||
Reference in New Issue
Block a user