1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-26 15:54:15 +01:00

OP-886 Fixes to styles and includes

+review OPReview-430
This commit is contained in:
Alessio Morale 2013-04-01 16:41:12 +02:00
parent 45b0e787a4
commit 23c0c3585c
3 changed files with 52 additions and 42 deletions

View File

@ -28,7 +28,7 @@
*/
#include "openpilot.h"
#include "alarms.h"
#include "inc/alarms.h"
// Private constants
@ -71,7 +71,10 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity
}
// Lock
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
if(xSemaphoreTakeRecursive(lock, portMAX_DELAY) != 0){
return -1;
}
// Read alarm and update its severity only if it was changed
SystemAlarmsGet(&alarms);
@ -99,28 +102,30 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions
{
SystemAlarmsData alarms;
// Check that this is a valid alarm
if (alarm >= SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM)
{
return -1;
}
// Check that this is a valid alarm
if (alarm >= SYSTEMALARMS_EXTENDEDALARMSTATUS_NUMELEM)
{
return -1;
}
// Lock
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
// Lock
if(xSemaphoreTakeRecursive(lock, portMAX_DELAY) != 0){
return -1;
}
// Read alarm and update its severity only if it was changed
SystemAlarmsGet(&alarms);
if ( alarms.Alarm[alarm] != severity )
{
alarms.ExtendedAlarmStatus[alarm] = status;
alarms.ExtendedAlarmSubStatus[alarm] = subStatus;
alarms.Alarm[alarm] = severity;
SystemAlarmsSet(&alarms);
}
// Read alarm and update its severity only if it was changed
SystemAlarmsGet(&alarms);
if (alarms.Alarm[alarm] != severity)
{
alarms.ExtendedAlarmStatus[alarm] = status;
alarms.ExtendedAlarmSubStatus[alarm] = subStatus;
alarms.Alarm[alarm] = severity;
SystemAlarmsSet(&alarms);
}
// Release lock
xSemaphoreGiveRecursive(lock);
return 0;
// Release lock
xSemaphoreGiveRecursive(lock);
return 0;
}
/**

View File

@ -26,13 +26,17 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "taskmonitor.h"
#include <openpilot.h>
#include <pios_board_info.h>
#include "sanitycheck.h"
#include "manualcontrolsettings.h"
#include "systemalarms.h"
#include "systemsettings.h"
// Private includes
#include "inc/taskmonitor.h"
#include "inc/sanitycheck.h"
// UAVOs
#include <manualcontrolsettings.h>
#include <systemalarms.h>
#include <systemsettings.h>
/****************************
* Current checks:

View File

@ -38,17 +38,20 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "openpilot.h"
#include "systemmod.h"
#include "objectpersistence.h"
#include "flightstatus.h"
#include "systemstats.h"
#include "systemsettings.h"
#include "i2cstats.h"
#include "taskinfo.h"
#include "watchdogstatus.h"
#include "taskmonitor.h"
#include "hwsettings.h"
#include <openpilot.h>
// private includes
#include "inc/systemmod.h"
// UAVOs
#include <objectpersistence.h>
#include <flightstatus.h>
#include <systemstats.h>
#include <systemsettings.h>
#include <i2cstats.h>
#include <taskinfo.h>
#include <watchdogstatus.h>
#include <taskmonitor.h>
#include <hwsettings.h>
// Flight Libraries
#include <sanitycheck.h>
@ -337,11 +340,9 @@ static void hwSettingsUpdatedCb(UAVObjEvent * ev)
HwSettingsData currentHwSettings;
HwSettingsGet(&currentHwSettings);
// check whether the Hw Configuration has changed from the one used at boot time
if(!memcmp(&bootHwSettings,&currentHwSettings,sizeof(HwSettingsData))){
return;
if(memcmp(&bootHwSettings, &currentHwSettings, sizeof(HwSettingsData)) != 0){
ExtendedAlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT,SYSTEMALARMS_ALARM_ERROR,BOOTFAULT_STATUS_ERROR_REQUIRE_REBOOT, 0);
}
ExtendedAlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT,SYSTEMALARMS_ALARM_ERROR,BOOTFAULT_STATUS_ERROR_REQUIRE_REBOOT, 0);
}
/**