mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
Flight/UAVObjects Added support for named arrays (i.e. each array element can have a name - needed for alarms)
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@531 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d0d620d1fe
commit
f999028753
@ -70,7 +70,8 @@ typedef struct {
|
||||
} __attribute__((packed)) ExampleObject1Data;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { EXAMPLEOBJECT1_FIELD8_OPTION1=0, EXAMPLEOBJECT1_FIELD8_OPTION2=1, } EXAMPLEOBJECT1FIELD8Enum;
|
||||
/* Enumeration options for field Field8 */
|
||||
typedef enum { EXAMPLEOBJECT1_FIELD8_OPTION1=0, EXAMPLEOBJECT1_FIELD8_OPTION2=1, } ExampleObject1Field8Options;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -65,7 +65,8 @@ typedef struct {
|
||||
} __attribute__((packed)) ExampleSettingsData;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { EXAMPLESETTINGS_STEPDIRECTION_UP=0, EXAMPLESETTINGS_STEPDIRECTION_DOWN=1, } EXAMPLESETTINGSSTEPDIRECTIONEnum;
|
||||
/* Enumeration options for field StepDirection */
|
||||
typedef enum { EXAMPLESETTINGS_STEPDIRECTION_UP=0, EXAMPLESETTINGS_STEPDIRECTION_DOWN=1, } ExampleSettingsStepDirectionOptions;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -68,7 +68,8 @@ typedef struct {
|
||||
} __attribute__((packed)) FlightTelemetryStatsData;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { FLIGHTTELEMETRYSTATS_CONNECTED_TRUE=0, FLIGHTTELEMETRYSTATS_CONNECTED_FALSE=1, } FLIGHTTELEMETRYSTATSCONNECTEDEnum;
|
||||
/* Enumeration options for field Connected */
|
||||
typedef enum { FLIGHTTELEMETRYSTATS_CONNECTED_TRUE=0, FLIGHTTELEMETRYSTATS_CONNECTED_FALSE=1, } FlightTelemetryStatsConnectedOptions;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -68,7 +68,8 @@ typedef struct {
|
||||
} __attribute__((packed)) GCSTelemetryStatsData;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { GCSTELEMETRYSTATS_CONNECTED_TRUE=0, GCSTELEMETRYSTATS_CONNECTED_FALSE=1, } GCSTELEMETRYSTATSCONNECTEDEnum;
|
||||
/* Enumeration options for field Connected */
|
||||
typedef enum { GCSTELEMETRYSTATS_CONNECTED_TRUE=0, GCSTELEMETRYSTATS_CONNECTED_FALSE=1, } GCSTelemetryStatsConnectedOptions;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -63,7 +63,8 @@ typedef struct {
|
||||
} __attribute__((packed)) SettingsPersistenceData;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { SETTINGSPERSISTENCE_OPERATION_LOAD=0, SETTINGSPERSISTENCE_OPERATION_SAVE=1, } SETTINGSPERSISTENCEOPERATIONEnum;
|
||||
/* Enumeration options for field Operation */
|
||||
typedef enum { SETTINGSPERSISTENCE_OPERATION_LOAD=0, SETTINGSPERSISTENCE_OPERATION_SAVE=1, } SettingsPersistenceOperationOptions;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "openpilot.h"
|
||||
|
||||
// Object constants
|
||||
#define SYSTEMALARMS_OBJID 1784134234U
|
||||
#define SYSTEMALARMS_OBJID 2311311912U
|
||||
#define SYSTEMALARMS_NAME "SystemAlarms"
|
||||
#define SYSTEMALARMS_ISSINGLEINST 1
|
||||
#define SYSTEMALARMS_ISSETTINGS 0
|
||||
@ -58,17 +58,15 @@
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t Type;
|
||||
uint8_t Severity;
|
||||
uint8_t Active;
|
||||
uint32_t Info;
|
||||
uint8_t Alarm[4];
|
||||
|
||||
} __attribute__((packed)) SystemAlarmsData;
|
||||
|
||||
// Enumeration types
|
||||
typedef enum { SYSTEMALARMS_TYPE_NONE=0, SYSTEMALARMS_TYPE_STACKOVERFLOW=1, SYSTEMALARMS_TYPE_OUTOFMEMORY=2, } SYSTEMALARMSTYPEEnum;
|
||||
typedef enum { SYSTEMALARMS_SEVERITY_INFO=0, SYSTEMALARMS_SEVERITY_WARNING=1, SYSTEMALARMS_SEVERITY_ERROR=2, SYSTEMALARMS_SEVERITY_CRITICAL=3, } SYSTEMALARMSSEVERITYEnum;
|
||||
typedef enum { SYSTEMALARMS_ACTIVE_TRUE=0, SYSTEMALARMS_ACTIVE_FALSE=1, } SYSTEMALARMSACTIVEEnum;
|
||||
/* Enumeration options for field Alarm */
|
||||
typedef enum { SYSTEMALARMS_ALARM_NONE=0, SYSTEMALARMS_ALARM_WARNING=1, SYSTEMALARMS_ALARM_ERROR=2, SYSTEMALARMS_ALARM_CRITICAL=3, } SystemAlarmsAlarmOptions;
|
||||
/* Array element names for field Alarm */
|
||||
typedef enum { SYSTEMALARMS_ALARM_OUTOFMEMORY=0, SYSTEMALARMS_ALARM_STACKOVERFLOW=1, SYSTEMALARMS_ALARM_CPUOVERLOAD=2, SYSTEMALARMS_ALARM_EVENTSYSTEM=3, } SystemAlarmsAlarmElem;
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -49,13 +49,13 @@ int32_t SystemAlarmsInitialize()
|
||||
|
||||
// Initialize metadata
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 4000;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.loggingUpdatePeriod = 1000;
|
||||
UAVObjSetMetadata(handle, &metadata);
|
||||
|
||||
// Done
|
||||
|
Loading…
x
Reference in New Issue
Block a user