LP-89 - Port OP_15.05.01 fixes. Release notes:
[librepilot.git] / flight / libraries / inc / sanitycheck.h
blob1c270f8e622e17d7b341e3ea77eb9ded2b26c2a0
1 /**
2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
4 * @{
5 * @addtogroup OpenPilotLibraries OpenPilot System Libraries
6 * @{
7 * @file sanitycheck.h
8 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
9 * @brief Utilities to validate a flight configuration
10 * @see The GNU Public License (GPL) Version 3
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef SANITYCHECK_H
31 #define SANITYCHECK_H
33 #include <systemalarms.h>
35 #include <stdint.h>
36 #include <utlist.h>
38 typedef enum {
39 FRAME_TYPE_MULTIROTOR,
40 FRAME_TYPE_HELI,
41 FRAME_TYPE_FIXED_WING,
42 FRAME_TYPE_GROUND,
43 FRAME_TYPE_CUSTOM,
44 } FrameType_t;
46 typedef SystemAlarmsExtendedAlarmStatusOptions (SANITYCHECK_CustomHook_function)();
48 #define SANITYCHECK_STATUS_ERROR_NONE SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE
49 #define SANITYCHECK_STATUS_ERROR_FLIGHTMODE SYSTEMALARMS_EXTENDEDALARMSTATUS_FLIGHTMODE
51 #define BOOTFAULT_STATUS_ERROR_NONE SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE
52 #define BOOTFAULT_STATUS_ERROR_REQUIRE_REBOOT SYSTEMALARMS_EXTENDEDALARMSTATUS_REBOOTREQUIRED
54 #if (SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM != SYSTEMALARMS_EXTENDEDALARMSUBSTATUS_NUMELEM) || \
55 (SYSTEMALARMS_EXTENDEDALARMSUBSTATUS_NUMELEM > SYSTEMALARMS_ALARM_NUMELEM)
56 #error Incongruent SystemAlarms. Please revise the UAVO definition in systemalarms.xml
57 #endif
59 extern int32_t configuration_check();
61 extern FrameType_t GetCurrentFrameType();
63 /**
64 * Attach a custom hook to the sanity check process
65 * @param hook a custom hook function
67 extern void SANITYCHECK_AttachHook(SANITYCHECK_CustomHook_function *hook);
69 /**
70 * Detach a custom hook to the sanity check process
71 * @param hook a custom hook function
73 extern void SANITYCHECK_DetachHook(SANITYCHECK_CustomHook_function *hook);
75 #endif /* SANITYCHECK_H */