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

View File

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

View File

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