1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Sanity Check: For now force the sanity check to run once a second and always set an error

This commit is contained in:
James Cotton 2012-10-25 12:43:56 -05:00
parent 68ae9f52c9
commit b9ebeb2c2e
4 changed files with 86 additions and 0 deletions

View File

@ -278,6 +278,7 @@ SRC += $(PIOSCOMMON)/printf-stdarg.c
SRC += $(FLIGHTLIB)/fifo_buffer.c
SRC += $(FLIGHTLIB)/CoordinateConversions.c
SRC += $(FLIGHTLIB)/taskmonitor.c
SRC += $(FLIGHTLIB)/sanitycheck.c
SRC += $(MATHLIB)/sin_lookup.c
SRC += $(MATHLIB)/pid.c

View File

@ -0,0 +1,34 @@
/**
******************************************************************************
* @addtogroup OpenPilotSystem OpenPilot System
* @{
* @addtogroup OpenPilotLibraries OpenPilot System Libraries
* @{
* @file sanitycheck.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Utilities to validate a flight configuration
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SANITYCHECK_H
#define SANITYCHECK_H
extern int32_t configuration_check();
#endif /* SANITYCHECK_H */

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
* @addtogroup OpenPilot System OpenPilot System
* @{
* @addtogroup OpenPilot Libraries OpenPilot System Libraries
* @{
* @file sanitycheck.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Utilities to validate a flight configuration
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "sanitycheck.h"
#include "hwsettings.h"
#include "taskinfo.h"
#include "manualcontrolsettings.h"
#include "systemalarms.h"
/**
* Run a preflight check over the hardware configuration
* and currently active modules
*/
int32_t configuration_check()
{
// TODO: Check manual control settings for any modes that can be accessed without the
// necessary module running
AlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, SYSTEMALARMS_ALARM_CRITICAL);
return 0;
}

View File

@ -40,6 +40,7 @@
#include "openpilot.h"
#include "systemmod.h"
#include "sanitycheck.h"
#include "objectpersistence.h"
#include "flightstatus.h"
#include "systemstats.h"
@ -172,6 +173,9 @@ static void systemTask(void *parameters)
// Update the system statistics
updateStats();
// TODO: Make this only be called when configuration settings change
configuration_check();
// Update the system alarms
updateSystemAlarms();
#if defined(I2C_WDG_STATS_DIAGNOSTICS)