diff --git a/flight/Modules/ManualControl/manualcontrol.c b/flight/Modules/ManualControl/manualcontrol.c index a4cd90f4a..cf0073db5 100644 --- a/flight/Modules/ManualControl/manualcontrol.c +++ b/flight/Modules/ManualControl/manualcontrol.c @@ -197,7 +197,7 @@ static void manualControlTask(void *parameters) /* trying to fly via GCS and lost connection. fall back to transmitter */ UAVObjMetadata metadata; ManualControlCommandGetMetadata(&metadata); - metadata.access = ACCESS_READWRITE; + UAVObjSetAccess(&metadata, ACCESS_READWRITE); ManualControlCommandSetMetadata(&metadata); } } diff --git a/flight/Modules/Telemetry/telemetry.c b/flight/Modules/Telemetry/telemetry.c index 12818529f..854e777df 100644 --- a/flight/Modules/Telemetry/telemetry.c +++ b/flight/Modules/Telemetry/telemetry.c @@ -73,7 +73,7 @@ static void telemetryTxTask(void *parameters); static void telemetryRxTask(void *parameters); static int32_t transmitData(uint8_t * data, int32_t length); static void registerObject(UAVObjHandle obj); -static void updateObject(UAVObjHandle obj); +static void updateObject(UAVObjHandle obj, int32_t eventType); static int32_t addObject(UAVObjHandle obj); static int32_t setUpdatePeriod(UAVObjHandle obj, int32_t updatePeriodMs); static void processObjEvent(UAVObjEvent * ev); @@ -158,32 +158,34 @@ static void registerObject(UAVObjHandle obj) addObject(obj); // Setup object for telemetry updates - updateObject(obj); + updateObject(obj, EV_NONE); } /** * Update object's queue connections and timer, depending on object's settings * \param[in] obj Object to updates */ -static void updateObject(UAVObjHandle obj) +static void updateObject(UAVObjHandle obj, int32_t eventType) { UAVObjMetadata metadata; + UAVObjUpdateMode updateMode; int32_t eventMask; // Get metadata UAVObjGetMetadata(obj, &metadata); + updateMode = UAVObjGetTelemetryUpdateMode(&metadata); // Setup object depending on update mode - if (metadata.telemetryUpdateMode == UPDATEMODE_PERIODIC) { + if (updateMode == UPDATEMODE_PERIODIC) { // Set update period setUpdatePeriod(obj, metadata.telemetryUpdatePeriod); // Connect queue - eventMask = EV_UPDATED_MANUAL | EV_UPDATE_REQ; + eventMask = EV_UPDATED_PERIODIC | EV_UPDATED_MANUAL | EV_UPDATE_REQ; if (UAVObjIsMetaobject(obj)) { eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) } UAVObjConnectQueue(obj, priorityQueue, eventMask); - } else if (metadata.telemetryUpdateMode == UPDATEMODE_ONCHANGE) { + } else if (updateMode == UPDATEMODE_ONCHANGE) { // Set update period setUpdatePeriod(obj, 0); // Connect queue @@ -192,7 +194,22 @@ static void updateObject(UAVObjHandle obj) eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) } UAVObjConnectQueue(obj, priorityQueue, eventMask); - } else if (metadata.telemetryUpdateMode == UPDATEMODE_MANUAL) { + } else if (updateMode == UPDATEMODE_THROTTLED) { + if ((eventType == EV_UPDATED_PERIODIC) || (eventType == EV_NONE)) { + // If we received a periodic update, we can change back to update on change + eventMask = EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ; + // Set update period on initialization and metadata change + if (eventType == EV_NONE) + setUpdatePeriod(obj, metadata.telemetryUpdatePeriod); + } else { + // Otherwise, we just received an object update, so switch to periodic for the timeout period to prevent more updates + eventMask = EV_UPDATED_PERIODIC | EV_UPDATED_MANUAL | EV_UPDATE_REQ; + } + if (UAVObjIsMetaobject(obj)) { + eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) + } + UAVObjConnectQueue(obj, priorityQueue, eventMask); + } else if (updateMode == UPDATEMODE_MANUAL) { // Set update period setUpdatePeriod(obj, 0); // Connect queue @@ -201,11 +218,6 @@ static void updateObject(UAVObjHandle obj) eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) } UAVObjConnectQueue(obj, priorityQueue, eventMask); - } else if (metadata.telemetryUpdateMode == UPDATEMODE_NEVER) { - // Set update period - setUpdatePeriod(obj, 0); - // Disconnect queue - UAVObjDisconnectQueue(obj, priorityQueue); } } @@ -215,6 +227,7 @@ static void updateObject(UAVObjHandle obj) static void processObjEvent(UAVObjEvent * ev) { UAVObjMetadata metadata; + UAVObjUpdateMode updateMode; FlightTelemetryStatsData flightStats; int32_t retries; int32_t success; @@ -226,16 +239,17 @@ static void processObjEvent(UAVObjEvent * ev) } else { // Only process event if connected to GCS or if object FlightTelemetryStats is updated FlightTelemetryStatsGet(&flightStats); + // Get object metadata + UAVObjGetMetadata(ev->obj, &metadata); + updateMode = UAVObjGetTelemetryUpdateMode(&metadata); if (flightStats.Status == FLIGHTTELEMETRYSTATS_STATUS_CONNECTED || ev->obj == FlightTelemetryStatsHandle()) { - // Get object metadata - UAVObjGetMetadata(ev->obj, &metadata); // Act on event retries = 0; success = -1; - if (ev->event == EV_UPDATED || ev->event == EV_UPDATED_MANUAL) { + if (ev->event == EV_UPDATED || ev->event == EV_UPDATED_MANUAL || ((ev->event == EV_UPDATED_PERIODIC) && (updateMode != UPDATEMODE_THROTTLED))) { // Send update to GCS (with retries) while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendObject(uavTalkCon, ev->obj, ev->instId, metadata.telemetryAcked, REQ_TIMEOUT_MS); // call blocks until ack is received or timeout + success = UAVTalkSendObject(uavTalkCon, ev->obj, ev->instId, UAVObjGetTelemetryAcked(&metadata), REQ_TIMEOUT_MS); // call blocks until ack is received or timeout ++retries; } // Update stats @@ -257,9 +271,13 @@ static void processObjEvent(UAVObjEvent * ev) } // If this is a metaobject then make necessary telemetry updates if (UAVObjIsMetaobject(ev->obj)) { - updateObject(UAVObjGetLinkedObj(ev->obj)); // linked object will be the actual object the metadata are for + updateObject(UAVObjGetLinkedObj(ev->obj), EV_NONE); // linked object will be the actual object the metadata are for } } + if((updateMode == UPDATEMODE_THROTTLED) && !UAVObjIsMetaobject(ev->obj)) { + // If this is UPDATEMODE_THROTTLED, the event mask changes on every event. + updateObject(ev->obj, ev->event); + } } } @@ -376,7 +394,7 @@ static int32_t addObject(UAVObjHandle obj) // Add object for periodic updates ev.obj = obj; ev.instId = UAVOBJ_ALL_INSTANCES; - ev.event = EV_UPDATED_MANUAL; + ev.event = EV_UPDATED_PERIODIC; return EventPeriodicQueueCreate(&ev, queue, 0); } @@ -394,7 +412,7 @@ static int32_t setUpdatePeriod(UAVObjHandle obj, int32_t updatePeriodMs) // Add object for periodic updates ev.obj = obj; ev.instId = UAVOBJ_ALL_INSTANCES; - ev.event = EV_UPDATED_MANUAL; + ev.event = EV_UPDATED_PERIODIC; return EventPeriodicQueueUpdate(&ev, queue, updatePeriodMs); } diff --git a/flight/UAVObjects/eventdispatcher.c b/flight/UAVObjects/eventdispatcher.c index 53a6e039d..f6eed78ff 100644 --- a/flight/UAVObjects/eventdispatcher.c +++ b/flight/UAVObjects/eventdispatcher.c @@ -59,7 +59,7 @@ typedef struct { */ struct PeriodicObjectListStruct { EventCallbackInfo evInfo; /** Event callback information */ - int32_t updatePeriodMs; /** Update period in ms or 0 if no periodic updates are needed */ + uint16_t updatePeriodMs; /** Update period in ms or 0 if no periodic updates are needed */ int32_t timeToNextUpdateMs; /** Time delay to the next update */ struct PeriodicObjectListStruct* next; /** Needed by linked list library (utlist.h) */ }; @@ -75,9 +75,9 @@ static EventStats stats; // Private functions static int32_t processPeriodicUpdates(); static void eventTask(); -static int32_t eventPeriodicCreate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, int32_t periodMs); -static int32_t eventPeriodicUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, int32_t periodMs); -static uint32_t randomizePeriod(uint32_t periodMs); +static int32_t eventPeriodicCreate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, uint16_t periodMs); +static int32_t eventPeriodicUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, uint16_t periodMs); +static uint16_t randomizePeriod(uint16_t periodMs); /** @@ -151,7 +151,7 @@ int32_t EventCallbackDispatch(UAVObjEvent* ev, UAVObjEventCallback cb) * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -int32_t EventPeriodicCallbackCreate(UAVObjEvent* ev, UAVObjEventCallback cb, int32_t periodMs) +int32_t EventPeriodicCallbackCreate(UAVObjEvent* ev, UAVObjEventCallback cb, uint16_t periodMs) { return eventPeriodicCreate(ev, cb, 0, periodMs); } @@ -163,7 +163,7 @@ int32_t EventPeriodicCallbackCreate(UAVObjEvent* ev, UAVObjEventCallback cb, int * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -int32_t EventPeriodicCallbackUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, int32_t periodMs) +int32_t EventPeriodicCallbackUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, uint16_t periodMs) { return eventPeriodicUpdate(ev, cb, 0, periodMs); } @@ -175,7 +175,7 @@ int32_t EventPeriodicCallbackUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, int * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -int32_t EventPeriodicQueueCreate(UAVObjEvent* ev, xQueueHandle queue, int32_t periodMs) +int32_t EventPeriodicQueueCreate(UAVObjEvent* ev, xQueueHandle queue, uint16_t periodMs) { return eventPeriodicCreate(ev, 0, queue, periodMs); } @@ -187,7 +187,7 @@ int32_t EventPeriodicQueueCreate(UAVObjEvent* ev, xQueueHandle queue, int32_t pe * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -int32_t EventPeriodicQueueUpdate(UAVObjEvent* ev, xQueueHandle queue, int32_t periodMs) +int32_t EventPeriodicQueueUpdate(UAVObjEvent* ev, xQueueHandle queue, uint16_t periodMs) { return eventPeriodicUpdate(ev, 0, queue, periodMs); } @@ -200,7 +200,7 @@ int32_t EventPeriodicQueueUpdate(UAVObjEvent* ev, xQueueHandle queue, int32_t pe * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -static int32_t eventPeriodicCreate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, int32_t periodMs) +static int32_t eventPeriodicCreate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, uint16_t periodMs) { PeriodicObjectList* objEntry; // Get lock @@ -244,7 +244,7 @@ static int32_t eventPeriodicCreate(UAVObjEvent* ev, UAVObjEventCallback cb, xQue * \param[in] periodMs The period the event is generated * \return Success (0), failure (-1) */ -static int32_t eventPeriodicUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, int32_t periodMs) +static int32_t eventPeriodicUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, xQueueHandle queue, uint16_t periodMs) { PeriodicObjectList* objEntry; // Get lock @@ -372,7 +372,7 @@ static int32_t processPeriodicUpdates() * Based on the Park-Miller-Carta Pseudo-Random Number Generator * http://www.firstpr.com.au/dsp/rand31/ */ -static uint32_t randomizePeriod(uint32_t periodMs) +static uint16_t randomizePeriod(uint16_t periodMs) { static uint32_t seed = 1; uint32_t hi, lo; @@ -382,6 +382,6 @@ static uint32_t randomizePeriod(uint32_t periodMs) lo += hi >> 15; if (lo > 0x7FFFFFFF) lo -= 0x7FFFFFFF; seed = lo; - return (uint32_t)( ((float)periodMs * (float)lo) / (float)0x7FFFFFFF ); + return (uint16_t)( ((float)periodMs * (float)lo) / (float)0x7FFFFFFF ); } diff --git a/flight/UAVObjects/inc/eventdispatcher.h b/flight/UAVObjects/inc/eventdispatcher.h index 9e378b65a..bfcb6b85e 100644 --- a/flight/UAVObjects/inc/eventdispatcher.h +++ b/flight/UAVObjects/inc/eventdispatcher.h @@ -39,9 +39,9 @@ int32_t EventDispatcherInitialize(); void EventGetStats(EventStats* statsOut); void EventClearStats(); int32_t EventCallbackDispatch(UAVObjEvent* ev, UAVObjEventCallback cb); -int32_t EventPeriodicCallbackCreate(UAVObjEvent* ev, UAVObjEventCallback cb, int32_t periodMs); -int32_t EventPeriodicCallbackUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, int32_t periodMs); -int32_t EventPeriodicQueueCreate(UAVObjEvent* ev, xQueueHandle queue, int32_t periodMs); -int32_t EventPeriodicQueueUpdate(UAVObjEvent* ev, xQueueHandle queue, int32_t periodMs); +int32_t EventPeriodicCallbackCreate(UAVObjEvent* ev, UAVObjEventCallback cb, uint16_t periodMs); +int32_t EventPeriodicCallbackUpdate(UAVObjEvent* ev, UAVObjEventCallback cb, uint16_t periodMs); +int32_t EventPeriodicQueueCreate(UAVObjEvent* ev, xQueueHandle queue, uint16_t periodMs); +int32_t EventPeriodicQueueUpdate(UAVObjEvent* ev, xQueueHandle queue, uint16_t periodMs); #endif // EVENTDISPATCHER_H diff --git a/flight/UAVObjects/inc/uavobjectmanager.h b/flight/UAVObjects/inc/uavobjectmanager.h index ac5d34b5c..08078acf5 100644 --- a/flight/UAVObjects/inc/uavobjectmanager.h +++ b/flight/UAVObjects/inc/uavobjectmanager.h @@ -35,6 +35,17 @@ #define UAVOBJ_ALL_INSTANCES 0xFFFF #define UAVOBJ_MAX_INSTANCES 1000 +/* + * Shifts and masks used to read/write metadata flags. + */ +#define UAVOBJ_ACCESS_SHIFT 0 +#define UAVOBJ_GCS_ACCESS_SHIFT 1 +#define UAVOBJ_TELEMETRY_ACKED_SHIFT 2 +#define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3 +#define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4 +#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6 +#define UAVOBJ_UPDATE_MODE_MASK 0x3 + // FIXME: All this typedef for SDCARD needs to be abstracted away #if !defined(PIOS_INCLUDE_SDCARD) @@ -50,42 +61,50 @@ typedef void* UAVObjHandle; typedef enum { UPDATEMODE_PERIODIC = 0, /** Automatically update object at periodic intervals */ UPDATEMODE_ONCHANGE = 1, /** Only update object when its data changes */ - UPDATEMODE_MANUAL = 2, /** Manually update object, by calling the updated() function */ - UPDATEMODE_NEVER = 3 /** Object is never updated */ + UPDATEMODE_THROTTLED = 2, /** Object is updated on change, but not more often than the interval time */ + UPDATEMODE_MANUAL = 3 /** Manually update object, by calling the updated() function */ } UAVObjUpdateMode; /** * Object metadata, each object has a meta object that holds its metadata. The metadata define * properties for each object and can be used by multiple modules (e.g. telemetry and logger) + * + * The object metadata flags are packed into a single 16 bit integer. + * The bits in the flag field are defined as: + * + * Bit(s) Name Meaning + * ------ ---- ------- + * 0 access Defines the access level for the local transactions (readonly=0 and readwrite=1) + * 1 gcsAccess Defines the access level for the local GCS transactions (readonly=0 and readwrite=1), not used in the flight s/w + * 2 telemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) + * 3 gcsTelemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) + * 4-5 telemetryUpdateMode Update mode used by the telemetry module (UAVObjUpdateMode) + * 6-7 gcsTelemetryUpdateMode Update mode used by the GCS (UAVObjUpdateMode) */ typedef struct { - uint8_t access; /** Defines the access level for the local transactions (readonly and readwrite) */ - uint8_t gcsAccess; /** Defines the access level for the local GCS transactions (readonly and readwrite), not used in the flight s/w */ - uint8_t telemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ - uint8_t telemetryUpdateMode; /** Update mode used by the telemetry module (UAVObjUpdateMode) */ - uint32_t telemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */ - uint8_t gcsTelemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ - uint8_t gcsTelemetryUpdateMode; /** Update mode used by the GCS (UAVObjUpdateMode) */ - uint32_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ - uint8_t loggingUpdateMode; /** Update mode used by the logging module (UAVObjUpdateMode) */ - uint32_t loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */ + uint8_t flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */ + uint16_t telemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */ + uint16_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ + uint16_t loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */ } __attribute__((packed)) UAVObjMetadata; /** * Event types generated by the objects. */ typedef enum { + EV_NONE = 0x00, /** No event */ EV_UNPACKED = 0x01, /** Object data updated by unpacking */ - EV_UPDATED = 0x02, /** Object data updated by changing the data structure */ - EV_UPDATED_MANUAL = 0x04, /** Object update event manually generated */ - EV_UPDATE_REQ = 0x08 /** Request to update object data */ + EV_UPDATED = 0x02, /** Object data updated by changing the data structure */ + EV_UPDATED_MANUAL = 0x04, /** Object update event manually generated */ + EV_UPDATED_PERIODIC = 0x08, /** Object update from periodic event */ + EV_UPDATE_REQ = 0x10 /** Request to update object data */ } UAVObjEventType; /** * Helper macros for event masks */ #define EV_MASK_ALL 0 -#define EV_MASK_ALL_UPDATES (EV_UNPACKED | EV_UPDATED | EV_UPDATED_MANUAL) +#define EV_MASK_ALL_UPDATES (EV_UNPACKED | EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATED_PERIODIC) /** * Access types @@ -162,10 +181,24 @@ int32_t UAVObjGetInstanceData(UAVObjHandle obj, uint16_t instId, void* dataOut); int32_t UAVObjGetInstanceDataField(UAVObjHandle obj, uint16_t instId, void* dataOut, uint32_t offset, uint32_t size); int32_t UAVObjSetMetadata(UAVObjHandle obj, const UAVObjMetadata* dataIn); int32_t UAVObjGetMetadata(UAVObjHandle obj, UAVObjMetadata* dataOut); +uint8_t UAVObjGetMetadataAccess(const UAVObjMetadata* dataOut); +void UAVObjMetadataInitialize(UAVObjMetadata* dataOut); +UAVObjAccessType UAVObjGetAccess(const UAVObjMetadata* dataOut); +void UAVObjSetAccess(UAVObjMetadata* dataOut, UAVObjAccessType mode); +UAVObjAccessType UAVObjGetGcsAccess(const UAVObjMetadata* dataOut); +void UAVObjSetGcsAccess(UAVObjMetadata* dataOut, UAVObjAccessType mode); +uint8_t UAVObjGetTelemetryAcked(const UAVObjMetadata* dataOut); +void UAVObjSetTelemetryAcked( UAVObjMetadata* dataOut, uint8_t val); +uint8_t UAVObjGetGcsTelemetryAcked(const UAVObjMetadata* dataOut); +void UAVObjSetGcsTelemetryAcked(UAVObjMetadata* dataOut, uint8_t val); +UAVObjUpdateMode UAVObjGetTelemetryUpdateMode(const UAVObjMetadata* dataOut); +void UAVObjSetTelemetryUpdateMode(UAVObjMetadata* dataOut, UAVObjUpdateMode val); +UAVObjUpdateMode UAVObjGetGcsTelemetryUpdateMode(const UAVObjMetadata* dataOut); +void UAVObjSetTelemetryGcsUpdateMode(UAVObjMetadata* dataOut, UAVObjUpdateMode val); int8_t UAVObjReadOnly(UAVObjHandle obj); -int32_t UAVObjConnectQueue(UAVObjHandle obj, xQueueHandle queue, int32_t eventMask); +int32_t UAVObjConnectQueue(UAVObjHandle obj, xQueueHandle queue, uint8_t eventMask); int32_t UAVObjDisconnectQueue(UAVObjHandle obj, xQueueHandle queue); -int32_t UAVObjConnectCallback(UAVObjHandle obj, UAVObjEventCallback cb, int32_t eventMask); +int32_t UAVObjConnectCallback(UAVObjHandle obj, UAVObjEventCallback cb, uint8_t eventMask); int32_t UAVObjDisconnectCallback(UAVObjHandle obj, UAVObjEventCallback cb); void UAVObjRequestUpdate(UAVObjHandle obj); void UAVObjRequestInstanceUpdate(UAVObjHandle obj, uint16_t instId); diff --git a/flight/UAVObjects/uavobjectmanager.c b/flight/UAVObjects/uavobjectmanager.c index 7d30bee7b..3eea7e450 100644 --- a/flight/UAVObjects/uavobjectmanager.c +++ b/flight/UAVObjects/uavobjectmanager.c @@ -37,13 +37,22 @@ // Private types +// Macros +#define SET_BITS(var, shift, value, mask) var = (var & ~(mask << shift)) | (value << shift); +#define OLGetIsMetaobject(olp) ((olp)->flags & OL_IS_METAOBJECT) +#define OLSetIsMetaobject(olp, val) ((olp)->flags = (((val) == 0) ? ((olp)->flags & ~OL_IS_METAOBJECT) : ((olp)->flags | OL_IS_METAOBJECT))) +#define OLGetIsSingleInstance(olp) ((olp)->flags & OL_IS_SINGLE_INSTANCE) +#define OLSetIsSingleInstance(olp, val) ((olp)->flags = (((val) == 0) ? ((olp)->flags & ~OL_IS_SINGLE_INSTANCE) : ((olp)->flags | OL_IS_SINGLE_INSTANCE))) +#define OLGetIsSettings(olp) ((olp)->flags & OL_IS_SETTINGS) +#define OLSetIsSettings(olp, val) ((olp)->flags = (((val) == 0) ? ((olp)->flags & ~OL_IS_SETTINGS) : ((olp)->flags | OL_IS_SETTINGS))) + /** * List of event queues and the eventmask associated with the queue. */ struct ObjectEventListStruct { xQueueHandle queue; UAVObjEventCallback cb; - int32_t eventMask; + uint8_t eventMask; struct ObjectEventListStruct *next; }; typedef struct ObjectEventListStruct ObjectEventList; @@ -58,6 +67,12 @@ struct ObjectInstListStruct { }; typedef struct ObjectInstListStruct ObjectInstList; +typedef enum { + OL_IS_METAOBJECT = 0x01, /** Set if this is a metaobject */ + OL_IS_SINGLE_INSTANCE = 0x02, /** Set if this object has a single instance */ + OL_IS_SETTINGS = 0x04 /** Set if this object is a settings object */ +} ObjectListFlags; + /** * List of objects registered in the object manager */ @@ -66,12 +81,8 @@ struct ObjectListStruct { /** The object ID */ const char *name; /** The object name */ - int8_t isMetaobject; - /** Set to 1 if this is a metaobject */ - int8_t isSingleInstance; - /** Set to 1 if this object has a single instance */ - int8_t isSettings; - /** Set to 1 if this object is a settings object */ + ObjectListFlags flags; + /** The object list mode flags */ uint16_t numBytes; /** Number of data bytes contained in the object (for a single instance) */ uint16_t numInstances; @@ -93,7 +104,7 @@ static int32_t sendEvent(ObjectList * obj, uint16_t instId, static ObjectInstList *createInstance(ObjectList * obj, uint16_t instId); static ObjectInstList *getInstance(ObjectList * obj, uint16_t instId); static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue, - UAVObjEventCallback cb, int32_t eventMask); + UAVObjEventCallback cb, uint8_t eventMask); static int32_t disconnectObj(UAVObjHandle obj, xQueueHandle queue, UAVObjEventCallback cb); @@ -125,16 +136,7 @@ int32_t UAVObjInitialize() return -1; // Initialize default metadata structure (metadata of metaobjects) - defMetadata.access = ACCESS_READWRITE; - defMetadata.gcsAccess = ACCESS_READWRITE; - defMetadata.telemetryAcked = 1; - defMetadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE; - defMetadata.telemetryUpdatePeriod = 0; - defMetadata.gcsTelemetryAcked = 1; - defMetadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE; - defMetadata.gcsTelemetryUpdatePeriod = 0; - defMetadata.loggingUpdateMode = UPDATEMODE_ONCHANGE; - defMetadata.loggingUpdatePeriod = 0; + UAVObjMetadataInitialize(&defMetadata); // Done return 0; @@ -204,9 +206,9 @@ UAVObjHandle UAVObjRegister(uint32_t id, const char *name, } objEntry->id = id; objEntry->name = name; - objEntry->isMetaobject = (int8_t) isMetaobject; - objEntry->isSingleInstance = (int8_t) isSingleInstance; - objEntry->isSettings = (int8_t) isSettings; + OLSetIsMetaobject(objEntry, isMetaobject); + OLSetIsSingleInstance(objEntry, isSingleInstance); + OLSetIsSettings(objEntry, isSettings); objEntry->numBytes = numBytes; objEntry->events = NULL; objEntry->numInstances = 0; @@ -243,11 +245,11 @@ UAVObjHandle UAVObjRegister(uint32_t id, const char *name, initCb((UAVObjHandle) objEntry, 0); } // Attempt to load object's metadata from the SD card (not done directly on the metaobject, but through the object) - if (!objEntry->isMetaobject) { + if (!OLGetIsMetaobject(objEntry)) { UAVObjLoad((UAVObjHandle) objEntry->linkedObj, 0); } // If this is a settings object, attempt to load from SD card - if (objEntry->isSettings) { + if (OLGetIsSettings(objEntry)) { UAVObjLoad((UAVObjHandle) objEntry, 0); } // Release lock @@ -403,7 +405,7 @@ uint16_t UAVObjCreateInstance(UAVObjHandle obj, */ int32_t UAVObjIsSingleInstance(UAVObjHandle obj) { - return ((ObjectList *) obj)->isSingleInstance; + return OLGetIsSingleInstance((ObjectList *) obj); } /** @@ -413,7 +415,7 @@ int32_t UAVObjIsSingleInstance(UAVObjHandle obj) */ int32_t UAVObjIsMetaobject(UAVObjHandle obj) { - return ((ObjectList *) obj)->isMetaobject; + return OLGetIsMetaobject((ObjectList *) obj); } /** @@ -423,7 +425,7 @@ int32_t UAVObjIsMetaobject(UAVObjHandle obj) */ int32_t UAVObjIsSettings(UAVObjHandle obj) { - return ((ObjectList *) obj)->isSettings; + return OLGetIsSettings((ObjectList *) obj); } /** @@ -539,7 +541,7 @@ int32_t UAVObjSaveToFile(UAVObjHandle obj, uint16_t instId, &bytesWritten); // Write the instance ID - if (!objEntry->isSingleInstance) { + if (!OLGetIsSingleInstance(objEntry)) { PIOS_FWRITE(file, &instEntry->instId, sizeof(instEntry->instId), &bytesWritten); } @@ -658,7 +660,7 @@ UAVObjHandle UAVObjLoadFromFile(FILEINFO * file) // Get the instance ID instId = 0; - if (!objEntry->isSingleInstance) { + if (!OLGetIsSingleInstance(objEntry)) { if (PIOS_FREAD (file, &instId, sizeof(instId), &bytesRead)) { xSemaphoreGiveRecursive(mutex); @@ -822,7 +824,7 @@ int32_t UAVObjSaveSettings() // Save all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isSettings) { + if (OLGetIsSettings(objEntry)) { // Save object if (UAVObjSave((UAVObjHandle) objEntry, 0) == -1) { @@ -851,7 +853,7 @@ int32_t UAVObjLoadSettings() // Load all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isSettings) { + if (OLGetIsSettings(objEntry)) { // Load object if (UAVObjLoad((UAVObjHandle) objEntry, 0) == -1) { @@ -880,7 +882,7 @@ int32_t UAVObjDeleteSettings() // Save all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isSettings) { + if (OLGetIsSettings(objEntry)) { // Save object if (UAVObjDelete((UAVObjHandle) objEntry, 0) == -1) { @@ -909,7 +911,7 @@ int32_t UAVObjSaveMetaobjects() // Save all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isMetaobject) { + if (OLGetIsMetaobject(objEntry)) { // Save object if (UAVObjSave((UAVObjHandle) objEntry, 0) == -1) { @@ -938,7 +940,7 @@ int32_t UAVObjLoadMetaobjects() // Load all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isMetaobject) { + if (OLGetIsMetaobject(objEntry)) { // Load object if (UAVObjLoad((UAVObjHandle) objEntry, 0) == -1) { @@ -967,7 +969,7 @@ int32_t UAVObjDeleteMetaobjects() // Load all settings objects LL_FOREACH(objList, objEntry) { // Check if this is a settings object - if (objEntry->isMetaobject) { + if (OLGetIsMetaobject(objEntry)) { // Load object if (UAVObjDelete((UAVObjHandle) objEntry, 0) == -1) { @@ -1047,11 +1049,11 @@ int32_t UAVObjSetInstanceData(UAVObjHandle obj, uint16_t instId, objEntry = (ObjectList *) obj; // Check access level - if (!objEntry->isMetaobject) { + if (!OLGetIsMetaobject(objEntry)) { mdata = (UAVObjMetadata *) (objEntry->linkedObj->instances. data); - if (mdata->access == ACCESS_READONLY) { + if (UAVObjGetAccess(mdata) == ACCESS_READONLY) { xSemaphoreGiveRecursive(mutex); return -1; } @@ -1094,10 +1096,10 @@ int32_t UAVObjSetInstanceDataField(UAVObjHandle obj, uint16_t instId, const void objEntry = (ObjectList*)obj; // Check access level - if ( !objEntry->isMetaobject ) + if ( !OLGetIsMetaobject(objEntry) ) { mdata = (UAVObjMetadata*)(objEntry->linkedObj->instances.data); - if ( mdata->access == ACCESS_READONLY ) + if ( UAVObjGetAccess(mdata) == ACCESS_READONLY ) { xSemaphoreGiveRecursive(mutex); return -1; @@ -1223,7 +1225,7 @@ int32_t UAVObjSetMetadata(UAVObjHandle obj, const UAVObjMetadata * dataIn) // Set metadata (metadata of metaobjects can not be modified) objEntry = (ObjectList *) obj; - if (!objEntry->isMetaobject) { + if (!OLGetIsMetaobject(objEntry)) { UAVObjSetData((UAVObjHandle) objEntry->linkedObj, dataIn); } else { @@ -1250,7 +1252,7 @@ int32_t UAVObjGetMetadata(UAVObjHandle obj, UAVObjMetadata * dataOut) // Get metadata objEntry = (ObjectList *) obj; - if (objEntry->isMetaobject) { + if (OLGetIsMetaobject(objEntry)) { memcpy(dataOut, &defMetadata, sizeof(UAVObjMetadata)); } else { UAVObjGetData((UAVObjHandle) objEntry->linkedObj, @@ -1262,6 +1264,136 @@ int32_t UAVObjGetMetadata(UAVObjHandle obj, UAVObjMetadata * dataOut) return 0; } +/** + * Initialize a UAVObjMetadata object. + * \param[in] metadata The metadata object + */ +void UAVObjMetadataInitialize(UAVObjMetadata* metadata) +{ + metadata->flags = + ACCESS_READWRITE << UAVOBJ_ACCESS_SHIFT | + ACCESS_READWRITE << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UPDATEMODE_ONCHANGE << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UPDATEMODE_ONCHANGE << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata->telemetryUpdatePeriod = 0; + metadata->gcsTelemetryUpdatePeriod = 0; + metadata->loggingUpdatePeriod = 0; +} + +/** + * Get the UAVObject metadata access member + * \param[in] metadata The metadata object + * \return the access type + */ +UAVObjAccessType UAVObjGetAccess(const UAVObjMetadata* metadata) +{ + return (metadata->flags >> UAVOBJ_ACCESS_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata access member + * \param[in] metadata The metadata object + * \param[in] mode The access mode + */ +void UAVObjSetAccess(UAVObjMetadata* metadata, UAVObjAccessType mode) +{ + SET_BITS(metadata->flags, UAVOBJ_ACCESS_SHIFT, mode, 1); +} + +/** + * Get the UAVObject metadata GCS access member + * \param[in] metadata The metadata object + * \return the GCS access type + */ +UAVObjAccessType UAVObjGetGcsAccess(const UAVObjMetadata* metadata) +{ + return (metadata->flags >> UAVOBJ_GCS_ACCESS_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata GCS access member + * \param[in] metadata The metadata object + * \param[in] mode The access mode + */ +void UAVObjSetGcsAccess(UAVObjMetadata* metadata, UAVObjAccessType mode) { + SET_BITS(metadata->flags, UAVOBJ_GCS_ACCESS_SHIFT, mode, 1); +} + +/** + * Get the UAVObject metadata telemetry acked member + * \param[in] metadata The metadata object + * \return the telemetry acked boolean + */ +uint8_t UAVObjGetTelemetryAcked(const UAVObjMetadata* metadata) { + return (metadata->flags >> UAVOBJ_TELEMETRY_ACKED_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata telemetry acked member + * \param[in] metadata The metadata object + * \param[in] val The telemetry acked boolean + */ +void UAVObjSetTelemetryAcked(UAVObjMetadata* metadata, uint8_t val) { + SET_BITS(metadata->flags, UAVOBJ_TELEMETRY_ACKED_SHIFT, val, 1); +} + +/** + * Get the UAVObject metadata GCS telemetry acked member + * \param[in] metadata The metadata object + * \return the telemetry acked boolean + */ +uint8_t UAVObjGetGcsTelemetryAcked(const UAVObjMetadata* metadata) { + return (metadata->flags >> UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata GCS telemetry acked member + * \param[in] metadata The metadata object + * \param[in] val The GCS telemetry acked boolean + */ +void UAVObjSetGcsTelemetryAcked(UAVObjMetadata* metadata, uint8_t val) { + SET_BITS(metadata->flags, UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT, val, 1); +} + +/** + * Get the UAVObject metadata telemetry update mode + * \param[in] metadata The metadata object + * \return the telemetry update mode + */ +UAVObjUpdateMode UAVObjGetTelemetryUpdateMode(const UAVObjMetadata* metadata) { + return (metadata->flags >> UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT) & UAVOBJ_UPDATE_MODE_MASK; +} + +/** + * Set the UAVObject metadata telemetry update mode member + * \param[in] metadata The metadata object + * \param[in] val The telemetry update mode + */ +void UAVObjSetTelemetryUpdateMode(UAVObjMetadata* metadata, UAVObjUpdateMode val) { + SET_BITS(metadata->flags, UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); +} + +/** + * Get the UAVObject metadata GCS telemetry update mode + * \param[in] metadata The metadata object + * \return the GCS telemetry update mode + */ +UAVObjUpdateMode UAVObjGetGcsTelemetryUpdateMode(const UAVObjMetadata* metadata) { + return (metadata->flags >> UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT) & UAVOBJ_UPDATE_MODE_MASK; +} + +/** + * Set the UAVObject metadata GCS telemetry update mode member + * \param[in] metadata The metadata object + * \param[in] val The GCS telemetry update mode + */ +void UAVObjSetGcsTelemetryUpdateMode(UAVObjMetadata* metadata, UAVObjUpdateMode val) { + SET_BITS(metadata->flags, UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); +} + + /** * Check if an object is read only * \param[in] obj The object handle @@ -1279,11 +1411,11 @@ int8_t UAVObjReadOnly(UAVObjHandle obj) objEntry = (ObjectList *) obj; // Check access level - if (!objEntry->isMetaobject) { + if (!OLGetIsMetaobject(objEntry)) { mdata = (UAVObjMetadata *) (objEntry->linkedObj->instances. data); - return mdata->access == ACCESS_READONLY; + return UAVObjGetAccess(mdata) == ACCESS_READONLY; } return -1; } @@ -1297,7 +1429,7 @@ int8_t UAVObjReadOnly(UAVObjHandle obj) * \return 0 if success or -1 if failure */ int32_t UAVObjConnectQueue(UAVObjHandle obj, xQueueHandle queue, - int32_t eventMask) + uint8_t eventMask) { int32_t res; xSemaphoreTakeRecursive(mutex, portMAX_DELAY); @@ -1330,7 +1462,7 @@ int32_t UAVObjDisconnectQueue(UAVObjHandle obj, xQueueHandle queue) * \return 0 if success or -1 if failure */ int32_t UAVObjConnectCallback(UAVObjHandle obj, UAVObjEventCallback cb, - int32_t eventMask) + uint8_t eventMask) { int32_t res; xSemaphoreTakeRecursive(mutex, portMAX_DELAY); @@ -1467,7 +1599,7 @@ static ObjectInstList *createInstance(ObjectList * obj, uint16_t instId) int32_t n; // For single instance objects, only instance zero is allowed - if (obj->isSingleInstance && instId != 0) { + if (OLGetIsSingleInstance(obj) && instId != 0) { return NULL; } // Make sure that the instance ID is within limits @@ -1541,7 +1673,7 @@ static ObjectInstList *getInstance(ObjectList * obj, uint16_t instId) * \return 0 if success or -1 if failure */ static int32_t connectObj(UAVObjHandle obj, xQueueHandle queue, - UAVObjEventCallback cb, int32_t eventMask) + UAVObjEventCallback cb, uint8_t eventMask) { ObjectEventList *eventEntry; ObjectList *objEntry; diff --git a/flight/UAVObjects/uavobjecttemplate.c b/flight/UAVObjects/uavobjecttemplate.c index 6d572dbcb..ad37eef83 100644 --- a/flight/UAVObjects/uavobjecttemplate.c +++ b/flight/UAVObjects/uavobjecttemplate.c @@ -85,15 +85,15 @@ $(INITFIELDS) UAVObjSetInstanceData(obj, instId, &data); // Initialize object metadata to their default values - metadata.access = $(FLIGHTACCESS); - metadata.gcsAccess = $(GCSACCESS); - metadata.telemetryAcked = $(FLIGHTTELEM_ACKED); - metadata.telemetryUpdateMode = $(FLIGHTTELEM_UPDATEMODE); + metadata.flags = + $(FLIGHTACCESS) << UAVOBJ_ACCESS_SHIFT | + $(GCSACCESS) << UAVOBJ_GCS_ACCESS_SHIFT | + $(FLIGHTTELEM_ACKED) << UAVOBJ_TELEMETRY_ACKED_SHIFT | + $(GCSTELEM_ACKED) << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + $(FLIGHTTELEM_UPDATEMODE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; metadata.telemetryUpdatePeriod = $(FLIGHTTELEM_UPDATEPERIOD); - metadata.gcsTelemetryAcked = $(GCSTELEM_ACKED); - metadata.gcsTelemetryUpdateMode = $(GCSTELEM_UPDATEMODE); metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD); - metadata.loggingUpdateMode = $(LOGGING_UPDATEMODE); metadata.loggingUpdatePeriod = $(LOGGING_UPDATEPERIOD); UAVObjSetMetadata(obj, &metadata); } diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp index 6d7a974c2..ff8265f26 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp @@ -1703,10 +1703,10 @@ void ConfigccpmWidget::enableSwashplateLevellingControl(bool state) if (state) { SwashLvlaccInitialData = mdata; - mdata.flightAccess = UAVObject::ACCESS_READONLY; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - mdata.gcsTelemetryAcked = false; - mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); + UAVObject::SetGcsTelemetryAcked(mdata, false); + UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); mdata.gcsTelemetryUpdatePeriod = 100; SwashLvlConfigurationInProgress=1; m_ccpm->TabObject->setTabEnabled(0,0); diff --git a/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp b/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp index 75cb57f78..24753f857 100644 --- a/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp @@ -298,7 +298,7 @@ void ConfigAHRSWidget::launchAccelBiasCalibration() obj = dynamic_cast(getObjectManager()->getObject(QString("AttitudeRaw"))); initialMdata = obj->getMetadata(); UAVObject::Metadata mdata = initialMdata; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; obj->setMetadata(mdata); @@ -380,7 +380,7 @@ void ConfigAHRSWidget::launchGyroDriftCalibration() obj = dynamic_cast(getObjectManager()->getObject(QString("AttitudeRaw"))); initialMdata = obj->getMetadata(); UAVObject::Metadata mdata = initialMdata; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; obj->setMetadata(mdata); @@ -998,7 +998,7 @@ void ConfigAHRSWidget::multiPointCalibrationMode() obj = getObjectManager()->getObject(QString("AttitudeRaw")); initialMdata = obj->getMetadata(); UAVObject::Metadata mdata = initialMdata; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; obj->setMetadata(mdata); diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp index 4ffabef66..85427b2b6 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp @@ -149,7 +149,7 @@ void ConfigCCAttitudeWidget::startAccelCalibration() { // Speed up updates initialMdata = obj->getMetadata(); UAVObject::Metadata mdata = initialMdata; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 100; obj->setMetadata(mdata); diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 1e8efef1f..4a2130b26 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -604,7 +604,7 @@ void ConfigInputWidget::fastMdata() { manualControlMdata = manualCommandObj->getMetadata(); UAVObject::Metadata mdata = manualControlMdata; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = 150; manualCommandObj->setMetadata(mdata); } diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 718965f7d..4b2f260b8 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -89,7 +89,7 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren UAVObjectManager *objManager = pm->getObject(); UAVObject* obj = objManager->getObject(QString("ActuatorCommand")); - if(obj->getMetadata().gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE) + if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) this->setEnabled(false); connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*))); } @@ -152,10 +152,10 @@ void ConfigOutputWidget::runChannelTests(bool state) { wasItMe=true; accInitialData = mdata; - mdata.flightAccess = UAVObject::ACCESS_READONLY; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - mdata.gcsTelemetryAcked = false; - mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); + UAVObject::SetGcsTelemetryAcked(mdata, false); + UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); mdata.gcsTelemetryUpdatePeriod = 100; } else @@ -382,7 +382,7 @@ void ConfigOutputWidget::stopTests() void ConfigOutputWidget::disableIfNotMe(UAVObject* obj) { - if(obj->getMetadata().gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE) + if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) { if(!wasItMe) this->setEnabled(false); diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index 62489f54c..dfbb023e2 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -110,7 +110,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi //Generate list of channels QStringList channels; channels << "None"; - for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { + for (unsigned int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { mixerTypes << QString("Mixer%1Type").arg(i+1); mixerVectors << QString("Mixer%1Vector").arg(i+1); channels << QString("Channel%1").arg(i+1); @@ -353,7 +353,7 @@ void ConfigVehicleTypeWidget::enableFFTest() UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ManualControlCommand"))); UAVObject::Metadata mdata = obj->getMetadata(); accInitialData = mdata; - mdata.flightAccess = UAVObject::ACCESS_READONLY; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); obj->setMetadata(mdata); } // Depending on phase, either move actuator or send FF settings: diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetwidget.cpp index 68f0162f5..6ee123ff6 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetwidget.cpp @@ -49,7 +49,7 @@ GCSControlGadgetWidget::GCSControlGadgetWidget(QWidget *parent) : QLabel(parent) UAVObjectManager *objManager = pm->getObject(); UAVDataObject* obj = dynamic_cast( objManager->getObject(QString("ManualControlCommand")) ); UAVObject::Metadata mdata = obj->getMetadata(); - m_gcscontrol->checkBoxGcsControl->setChecked(mdata.flightAccess == UAVObject::ACCESS_READONLY); + m_gcscontrol->checkBoxGcsControl->setChecked(UAVObject::GetFlightAccess(mdata) == UAVObject::ACCESS_READONLY); // Set up the drop down box for the flightmode UAVDataObject* flightStatus = dynamic_cast( objManager->getObject(QString("FlightStatus")) ); @@ -117,10 +117,10 @@ void GCSControlGadgetWidget::toggleControl(int state) if (state) { mccInitialData = mdata; - mdata.flightAccess = UAVObject::ACCESS_READONLY; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - mdata.gcsTelemetryAcked = false; - mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); + UAVObject::SetGcsTelemetryAcked(mdata, false); + UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); mdata.gcsTelemetryUpdatePeriod = 100; } diff --git a/ground/openpilotgcs/src/plugins/hitlnew/simulator.cpp b/ground/openpilotgcs/src/plugins/hitlnew/simulator.cpp index c6e2a27e1..e701f0485 100644 --- a/ground/openpilotgcs/src/plugins/hitlnew/simulator.cpp +++ b/ground/openpilotgcs/src/plugins/hitlnew/simulator.cpp @@ -236,12 +236,12 @@ void Simulator::setupInputObject(UAVObject* obj, int updatePeriod) { UAVObject::Metadata mdata; mdata = obj->getDefaultMetadata(); - mdata.flightAccess = UAVObject::ACCESS_READWRITE; - mdata.gcsAccess = UAVObject::ACCESS_READWRITE; - mdata.flightTelemetryAcked = false; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READWRITE); + UAVObject::SetGcsAccess(mdata, UAVObject::ACCESS_READWRITE); + UAVObject::SetFlightTelemetryAcked(mdata, false); + UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.flightTelemetryUpdatePeriod = updatePeriod; - mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL; + UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_MANUAL); obj->setMetadata(mdata); } @@ -249,11 +249,11 @@ void Simulator::setupOutputObject(UAVObject* obj, int updatePeriod) { UAVObject::Metadata mdata; mdata = obj->getDefaultMetadata(); - mdata.flightAccess = UAVObject::ACCESS_READONLY; - mdata.gcsAccess = UAVObject::ACCESS_READWRITE; - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_NEVER; - mdata.gcsTelemetryAcked = false; - mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); + UAVObject::SetGcsAccess(mdata, UAVObject::ACCESS_READWRITE); + UAVObject::SetFlightTelemetryUpdateMode(mdata,UAVObject::UPDATEMODE_MANUAL); + UAVObject::SetGcsTelemetryAcked(mdata, false); + UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC); mdata.gcsTelemetryUpdatePeriod = updatePeriod; obj->setMetadata(mdata); } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/tests/uavobjectstest.h b/ground/openpilotgcs/src/plugins/uavobjects/tests/uavobjectstest.h index 107bccb8f..1b5956b11 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/tests/uavobjectstest.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/tests/uavobjectstest.h @@ -18,6 +18,7 @@ private slots: void objectUpdated(UAVObject* obj); void objectUpdatedAuto(UAVObject* obj); void objectUpdatedManual(UAVObject* obj); + void objectUpdatedPeriodic(UAVObject* obj); void objectUnpacked(UAVObject* obj); void updateRequested(UAVObject* obj); void runTest(); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp index 54a5a7736..bb45495f5 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp @@ -36,16 +36,7 @@ UAVMetaObject::UAVMetaObject(quint32 objID, const QString& name, UAVObject* pare { this->parent = parent; // Setup default metadata of metaobject (can not be changed) - ownMetadata.flightAccess = ACCESS_READWRITE; - ownMetadata.gcsAccess = ACCESS_READWRITE; - ownMetadata.flightTelemetryAcked = 1; - ownMetadata.flightTelemetryUpdateMode = UPDATEMODE_ONCHANGE; - ownMetadata.flightTelemetryUpdatePeriod = 0; - ownMetadata.gcsTelemetryAcked = 1; - ownMetadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE; - ownMetadata.gcsTelemetryUpdatePeriod = 0; - ownMetadata.loggingUpdateMode = UPDATEMODE_ONCHANGE; - ownMetadata.loggingUpdatePeriod = 0; + UAVObject::MetadataInitialize(ownMetadata); // Setup fields QStringList boolEnum; boolEnum << tr("False") << tr("True"); @@ -54,16 +45,10 @@ UAVMetaObject::UAVMetaObject(quint32 objID, const QString& name, UAVObject* pare QStringList accessModeEnum; accessModeEnum << tr("Read/Write") << tr("Read Only"); QList fields; - fields.append( new UAVObjectField(tr("Flight Access Mode"), tr(""), UAVObjectField::ENUM, 1, accessModeEnum) ); - fields.append( new UAVObjectField(tr("GCS Access Mode"), tr(""), UAVObjectField::ENUM, 1, accessModeEnum) ); - fields.append( new UAVObjectField(tr("Flight Telemetry Acked"), tr(""), UAVObjectField::ENUM, 1, boolEnum) ); - fields.append( new UAVObjectField(tr("Flight Telemetry Update Mode"), tr(""), UAVObjectField::ENUM, 1, updateModeEnum) ); - fields.append( new UAVObjectField(tr("Flight Telemetry Update Period"), tr(""), UAVObjectField::UINT32, 1, QStringList()) ); - fields.append( new UAVObjectField(tr("GCS Telemetry Acked"), tr(""), UAVObjectField::ENUM, 1, boolEnum) ); - fields.append( new UAVObjectField(tr("GCS Telemetry Update Mode"), tr(""), UAVObjectField::ENUM, 1, updateModeEnum) ); - fields.append( new UAVObjectField(tr("GCS Telemetry Update Period"), tr(""), UAVObjectField::UINT32, 1, QStringList()) ); - fields.append( new UAVObjectField(tr("Logging Update Mode"), tr(""), UAVObjectField::ENUM, 1, updateModeEnum) ); - fields.append( new UAVObjectField(tr("Logging Update Period"), tr(""), UAVObjectField::UINT32, 1, QStringList()) ); + fields.append( new UAVObjectField(tr("Modes"), tr(""), UAVObjectField::UINT8, 1, accessModeEnum) ); + fields.append( new UAVObjectField(tr("Flight Telemetry Update Period"), tr(""), UAVObjectField::UINT16, 1, QStringList()) ); + fields.append( new UAVObjectField(tr("GCS Telemetry Update Period"), tr(""), UAVObjectField::UINT16, 1, QStringList()) ); + fields.append( new UAVObjectField(tr("Logging Update Period"), tr(""), UAVObjectField::UINT16, 1, QStringList()) ); // Initialize parent UAVObject::initialize(0); UAVObject::initializeFields(fields, (quint8*)&parentMetadata, sizeof(Metadata)); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index c7161bc64..c1ba625fc 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -29,6 +29,18 @@ #include #include +// Constants +#define UAVOBJ_ACCESS_SHIFT 0 +#define UAVOBJ_GCS_ACCESS_SHIFT 1 +#define UAVOBJ_TELEMETRY_ACKED_SHIFT 2 +#define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3 +#define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4 +#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6 +#define UAVOBJ_UPDATE_MODE_MASK 0x3 + +// Macros +#define SET_BITS(var, shift, value, mask) var = (var & ~(mask << shift)) | (value << shift); + /** * Constructor * @param objID The object ID @@ -456,3 +468,132 @@ void UAVObject::emitTransactionCompleted(bool success) { emit transactionCompleted(this, success); } + +/** + * Initialize a UAVObjMetadata object. + * \param[in] metadata The metadata object + */ +void UAVObject::MetadataInitialize(UAVObject::Metadata& metadata) +{ + metadata.flags = + ACCESS_READWRITE << UAVOBJ_ACCESS_SHIFT | + ACCESS_READWRITE << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UPDATEMODE_ONCHANGE << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UPDATEMODE_ONCHANGE << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; +} + +/** + * Get the UAVObject metadata access member + * \param[in] metadata The metadata object + * \return the access type + */ +UAVObject::AccessMode UAVObject::GetFlightAccess(const UAVObject::Metadata& metadata) +{ + return UAVObject::AccessMode((metadata.flags >> UAVOBJ_ACCESS_SHIFT) & 1); +} + +/** + * Set the UAVObject metadata access member + * \param[in] metadata The metadata object + * \param[in] mode The access mode + */ +void UAVObject::SetFlightAccess(UAVObject::Metadata& metadata, UAVObject::AccessMode mode) +{ + SET_BITS(metadata.flags, UAVOBJ_ACCESS_SHIFT, mode, 1); +} + +/** + * Get the UAVObject metadata GCS access member + * \param[in] metadata The metadata object + * \return the GCS access type + */ +UAVObject::AccessMode UAVObject::GetGcsAccess(const UAVObject::Metadata& metadata) +{ + return UAVObject::AccessMode((metadata.flags >> UAVOBJ_GCS_ACCESS_SHIFT) & 1); +} + +/** + * Set the UAVObject metadata GCS access member + * \param[in] metadata The metadata object + * \param[in] mode The access mode + */ +void UAVObject::SetGcsAccess(UAVObject::Metadata& metadata, UAVObject::AccessMode mode) { + SET_BITS(metadata.flags, UAVOBJ_GCS_ACCESS_SHIFT, mode, 1); +} + +/** + * Get the UAVObject metadata telemetry acked member + * \param[in] metadata The metadata object + * \return the telemetry acked boolean + */ +uint8_t UAVObject::GetFlightTelemetryAcked(const UAVObject::Metadata& metadata) { + return (metadata.flags >> UAVOBJ_TELEMETRY_ACKED_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata telemetry acked member + * \param[in] metadata The metadata object + * \param[in] val The telemetry acked boolean + */ +void UAVObject::SetFlightTelemetryAcked(UAVObject::Metadata& metadata, uint8_t val) { + SET_BITS(metadata.flags, UAVOBJ_TELEMETRY_ACKED_SHIFT, val, 1); +} + +/** + * Get the UAVObject metadata GCS telemetry acked member + * \param[in] metadata The metadata object + * \return the telemetry acked boolean + */ +uint8_t UAVObject::GetGcsTelemetryAcked(const UAVObject::Metadata& metadata) { + return (metadata.flags >> UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT) & 1; +} + +/** + * Set the UAVObject metadata GCS telemetry acked member + * \param[in] metadata The metadata object + * \param[in] val The GCS telemetry acked boolean + */ +void UAVObject::SetGcsTelemetryAcked(UAVObject::Metadata& metadata, uint8_t val) { + SET_BITS(metadata.flags, UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT, val, 1); +} + +/** + * Get the UAVObject metadata telemetry update mode + * \param[in] metadata The metadata object + * \return the telemetry update mode + */ +UAVObject::UpdateMode UAVObject::GetFlightTelemetryUpdateMode(const UAVObject::Metadata& metadata) { + return UAVObject::UpdateMode((metadata.flags >> UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT) & UAVOBJ_UPDATE_MODE_MASK); +} + +/** + * Set the UAVObject metadata telemetry update mode member + * \param[in] metadata The metadata object + * \param[in] val The telemetry update mode + */ +void UAVObject::SetFlightTelemetryUpdateMode(UAVObject::Metadata& metadata, UAVObject::UpdateMode val) { + SET_BITS(metadata.flags, UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); +} + +/** + * Get the UAVObject metadata GCS telemetry update mode + * \param[in] metadata The metadata object + * \return the GCS telemetry update mode + */ +UAVObject::UpdateMode UAVObject::GetGcsTelemetryUpdateMode(const UAVObject::Metadata& metadata) { + return UAVObject::UpdateMode((metadata.flags >> UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT) & UAVOBJ_UPDATE_MODE_MASK); +} + +/** + * Set the UAVObject metadata GCS telemetry update mode member + * \param[in] metadata The metadata object + * \param[in] val The GCS telemetry update mode + */ +void UAVObject::SetGcsTelemetryUpdateMode(UAVObject::Metadata& metadata, UAVObject::UpdateMode val) { + SET_BITS(metadata.flags, UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); +} diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h index aa6db086d..62b96da02 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h @@ -38,6 +38,14 @@ #include #include "uavobjectfield.h" +#define UAVOBJ_ACCESS_SHIFT 0 +#define UAVOBJ_GCS_ACCESS_SHIFT 1 +#define UAVOBJ_TELEMETRY_ACKED_SHIFT 2 +#define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3 +#define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4 +#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6 +#define UAVOBJ_UPDATE_MODE_MASK 0x3 + class UAVObjectField; class UAVOBJECTS_EXPORT UAVObject: public QObject @@ -52,8 +60,8 @@ public: typedef enum { UPDATEMODE_PERIODIC = 0, /** Automatically update object at periodic intervals */ UPDATEMODE_ONCHANGE = 1, /** Only update object when its data changes */ - UPDATEMODE_MANUAL = 2, /** Manually update object, by calling the updated() function */ - UPDATEMODE_NEVER = 3 /** Object is never updated */ + UPDATEMODE_THROTTLED = 2, /** Object is updated on change, but not more often than the interval time */ + UPDATEMODE_MANUAL = 3 /** Manually update object, by calling the updated() function */ } UpdateMode; /** @@ -67,19 +75,25 @@ public: /** * Object metadata, each object has a meta object that holds its metadata. The metadata define * properties for each object and can be used by multiple modules (e.g. telemetry and logger) + * + * The object metadata flags are packed into a single 16 bit integer. + * The bits in the flag field are defined as: + * + * Bit(s) Name Meaning + * ------ ---- ------- + * 0 access Defines the access level for the local transactions (readonly=0 and readwrite=1) + * 1 gcsAccess Defines the access level for the local GCS transactions (readonly=0 and readwrite=1), not used in the flight s/w + * 2 telemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) + * 3 gcsTelemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) + * 4-5 telemetryUpdateMode Update mode used by the telemetry module (UAVObjUpdateMode) + * 6-7 gcsTelemetryUpdateMode Update mode used by the GCS (UAVObjUpdateMode) */ - typedef struct { - quint8 flightAccess; /** Defines the access level for the local flight transactions (readonly and readwrite) */ - quint8 gcsAccess; /** Defines the access level for the local GCS transactions (readonly and readwrite) */ - quint8 flightTelemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ - quint8 flightTelemetryUpdateMode; /** Update mode used by the autopilot (UpdateMode) */ - qint32 flightTelemetryUpdatePeriod; /** Update period used by the autopilot (only if telemetry mode is PERIODIC) */ - quint8 gcsTelemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ - quint8 gcsTelemetryUpdateMode; /** Update mode used by the GCS (UpdateMode) */ - qint32 gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ - quint8 loggingUpdateMode; /** Update mode used by the logging module (UpdateMode) */ - qint32 loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */ - } __attribute__((packed)) Metadata; + typedef struct { + uint8_t flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */ + uint16_t flightTelemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */ + uint16_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ + uint16_t loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */ + } __attribute__((packed)) Metadata; UAVObject(quint32 objID, bool isSingleInst, const QString& name); @@ -111,6 +125,21 @@ public: QString toStringData(); void emitTransactionCompleted(bool success); + // Metadata accessors + static void MetadataInitialize(Metadata& meta); + static AccessMode GetFlightAccess(const Metadata& meta); + static void SetFlightAccess(Metadata& meta, AccessMode mode); + static AccessMode GetGcsAccess(const Metadata& meta); + static void SetGcsAccess(Metadata& meta, AccessMode mode); + static uint8_t GetFlightTelemetryAcked(const Metadata& meta); + static void SetFlightTelemetryAcked(Metadata& meta, uint8_t val); + static uint8_t GetGcsTelemetryAcked(const Metadata& meta); + static void SetGcsTelemetryAcked(Metadata& meta, uint8_t val); + static UpdateMode GetFlightTelemetryUpdateMode(const Metadata& meta); + static void SetFlightTelemetryUpdateMode(Metadata& meta, UpdateMode val); + static UpdateMode GetGcsTelemetryUpdateMode(const Metadata& meta); + static void SetGcsTelemetryUpdateMode(Metadata& meta, UpdateMode val); + public slots: void requestUpdate(); void updated(); @@ -119,6 +148,7 @@ signals: void objectUpdated(UAVObject* obj); void objectUpdatedAuto(UAVObject* obj); void objectUpdatedManual(UAVObject* obj); + void objectUpdatedPeriodic(UAVObject* obj); void objectUnpacked(UAVObject* obj); void updateRequested(UAVObject* obj); void transactionCompleted(UAVObject* obj, bool success); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index ed9644988..f5df52396 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -833,7 +833,7 @@ bool UAVObjectField::checkValue(const QVariant& value, quint32 index) // Get metadata UAVObject::Metadata mdata = obj->getMetadata(); // Update value if the access mode permits - if ( mdata.gcsAccess == UAVObject::ACCESS_READWRITE ) + if ( UAVObject::GetFlightAccess(mdata) == UAVObject::ACCESS_READWRITE ) { switch (type) { @@ -873,7 +873,7 @@ void UAVObjectField::setValue(const QVariant& value, quint32 index) // Get metadata UAVObject::Metadata mdata = obj->getMetadata(); // Update value if the access mode permits - if ( mdata.gcsAccess == UAVObject::ACCESS_READWRITE ) + if ( UAVObject::GetGcsAccess(mdata) == UAVObject::ACCESS_READWRITE ) { switch (type) { diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp index d38bcdbc5..58aa84ead 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp @@ -61,15 +61,15 @@ $(FIELDSINIT) UAVObject::Metadata $(NAME)::getDefaultMetadata() { UAVObject::Metadata metadata; - metadata.flightAccess = $(FLIGHTACCESS); - metadata.gcsAccess = $(GCSACCESS); - metadata.gcsTelemetryAcked = $(GCSTELEM_ACKED); - metadata.gcsTelemetryUpdateMode = UAVObject::$(GCSTELEM_UPDATEMODE); - metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD); - metadata.flightTelemetryAcked = $(FLIGHTTELEM_ACKED); - metadata.flightTelemetryUpdateMode = UAVObject::$(FLIGHTTELEM_UPDATEMODE); + metadata.flags = + $(FLIGHTACCESS) << UAVOBJ_ACCESS_SHIFT | + $(GCSACCESS) << UAVOBJ_GCS_ACCESS_SHIFT | + $(FLIGHTTELEM_ACKED) << UAVOBJ_TELEMETRY_ACKED_SHIFT | + $(GCSTELEM_ACKED) << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + $(FLIGHTTELEM_UPDATEMODE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; metadata.flightTelemetryUpdatePeriod = $(FLIGHTTELEM_UPDATEPERIOD); - metadata.loggingUpdateMode = UAVObject::$(LOGGING_UPDATEMODE); + metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD); metadata.loggingUpdatePeriod = $(LOGGING_UPDATEPERIOD); return metadata; } @@ -102,7 +102,7 @@ void $(NAME)::setData(const DataFields& data) // Get metadata Metadata mdata = getMetadata(); // Update object if the access mode permits - if ( mdata.gcsAccess == ACCESS_READWRITE ) + if ( UAVObject::GetGcsAccess(mdata) == ACCESS_READWRITE ) { this->data = data; emit objectUpdatedAuto(this); // trigger object updated event diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp index 31ae969eb..260175a26 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp @@ -77,7 +77,7 @@ void smartSaveButton::processOperation(QPushButton * button,bool save) foreach(UAVDataObject * obj,objects) { UAVObject::Metadata mdata= obj->getMetadata(); - if(mdata.gcsAccess==UAVObject::ACCESS_READONLY) + if(UAVObject::GetGcsAccess(mdata)==UAVObject::ACCESS_READONLY) continue; up_result=false; current_object=obj; diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp index 186233ca0..f01c66c43 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.cpp @@ -77,7 +77,7 @@ void Telemetry::registerObject(UAVObject* obj) addObject(obj); // Setup object for telemetry updates - updateObject(obj); + updateObject(obj, EV_NONE); } /** @@ -142,6 +142,10 @@ void Telemetry::connectToObjectInstances(UAVObject* obj, quint32 eventMask) { connect(objs[n], SIGNAL(objectUpdatedManual(UAVObject*)), this, SLOT(objectUpdatedManual(UAVObject*))); } + if ( (eventMask&EV_UPDATED_PERIODIC) != 0) + { + connect(objs[n], SIGNAL(objectUpdatedPeriodic(UAVObject*)), this, SLOT(objectUpdatedPeriodic(UAVObject*))); + } if ( (eventMask&EV_UPDATE_REQ) != 0) { connect(objs[n], SIGNAL(updateRequested(UAVObject*)), this, SLOT(updateRequested(UAVObject*))); @@ -152,26 +156,27 @@ void Telemetry::connectToObjectInstances(UAVObject* obj, quint32 eventMask) /** * Update an object based on its metadata properties */ -void Telemetry::updateObject(UAVObject* obj) +void Telemetry::updateObject(UAVObject* obj, quint32 eventType) { // Get metadata UAVObject::Metadata metadata = obj->getMetadata(); + UAVObject::UpdateMode updateMode = UAVObject::GetGcsTelemetryUpdateMode(metadata); // Setup object depending on update mode qint32 eventMask; - if ( metadata.gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_PERIODIC ) + if ( updateMode == UAVObject::UPDATEMODE_PERIODIC ) { // Set update period setUpdatePeriod(obj, metadata.gcsTelemetryUpdatePeriod); // Connect signals for all instances - eventMask = EV_UPDATED_MANUAL | EV_UPDATE_REQ; + eventMask = EV_UPDATED_MANUAL | EV_UPDATE_REQ | EV_UPDATED_PERIODIC; if( dynamic_cast(obj) != NULL ) { eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) } connectToObjectInstances(obj, eventMask); } - else if ( metadata.gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE ) + else if ( updateMode == UAVObject::UPDATEMODE_ONCHANGE ) { // Set update period setUpdatePeriod(obj, 0); @@ -183,7 +188,29 @@ void Telemetry::updateObject(UAVObject* obj) } connectToObjectInstances(obj, eventMask); } - else if ( metadata.gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_MANUAL ) + else if ( updateMode == UAVObject::UPDATEMODE_THROTTLED ) + { + // If we received a periodic update, we can change back to update on change + if ((eventType == EV_UPDATED_PERIODIC) || (eventType == EV_NONE)) { + // Set update period + if (eventType == EV_NONE) + setUpdatePeriod(obj, metadata.gcsTelemetryUpdatePeriod); + // Connect signals for all instances + eventMask = EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ | EV_UPDATED_PERIODIC; + } + else + { + // Otherwise, we just received an object update, so switch to periodic for the timeout period to prevent more updates + // Connect signals for all instances + eventMask = EV_UPDATED | EV_UPDATED_MANUAL | EV_UPDATE_REQ; + } + if( dynamic_cast(obj) != NULL ) + { + eventMask |= EV_UNPACKED; // we also need to act on remote updates (unpack events) + } + connectToObjectInstances(obj, eventMask); + } + else if ( updateMode == UAVObject::UPDATEMODE_MANUAL ) { // Set update period setUpdatePeriod(obj, 0); @@ -195,13 +222,6 @@ void Telemetry::updateObject(UAVObject* obj) } connectToObjectInstances(obj, eventMask); } - else if ( metadata.gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_NEVER ) - { - // Set update period - setUpdatePeriod(obj, 0); - // Disconnect from object - connectToObjectInstances(obj, 0); - } } /** @@ -381,14 +401,16 @@ void Telemetry::processObjectQueue() } // Setup transaction (skip if unpack event) - if ( objInfo.event != EV_UNPACKED ) + UAVObject::Metadata metadata = objInfo.obj->getMetadata(); + UAVObject::UpdateMode updateMode = UAVObject::GetGcsTelemetryUpdateMode(metadata); + if ( ( objInfo.event != EV_UNPACKED ) && ( ( objInfo.event != EV_UPDATED_PERIODIC ) || ( updateMode != UAVObject::UPDATEMODE_THROTTLED ) ) ) { UAVObject::Metadata metadata = objInfo.obj->getMetadata(); transInfo.obj = objInfo.obj; transInfo.allInstances = objInfo.allInstances; transInfo.retriesRemaining = MAX_RETRIES; - transInfo.acked = metadata.gcsTelemetryAcked; - if ( objInfo.event == EV_UPDATED || objInfo.event == EV_UPDATED_MANUAL ) + transInfo.acked = UAVObject::GetGcsTelemetryAcked(metadata); + if ( objInfo.event == EV_UPDATED || objInfo.event == EV_UPDATED_MANUAL || objInfo.event == EV_UPDATED_PERIODIC ) { transInfo.objRequest = false; } @@ -408,7 +430,11 @@ void Telemetry::processObjectQueue() UAVMetaObject* metaobj = dynamic_cast(objInfo.obj); if ( metaobj != NULL ) { - updateObject( metaobj->getParentObject() ); + updateObject( metaobj->getParentObject(), EV_NONE ); + } + else if ( updateMode != UAVObject::UPDATEMODE_THROTTLED ) + { + updateObject( objInfo.obj, objInfo.event ); } // The fact we received an unpacked event does not mean that @@ -417,7 +443,6 @@ void Telemetry::processObjectQueue() // stuck: if ( objInfo.event == EV_UNPACKED ) processObjectQueue(); - } /** @@ -453,7 +478,7 @@ void Telemetry::processPeriodicUpdates() objinfo->timeToNextUpdateMs = objinfo->updatePeriodMs - offset; // Send object time.start(); - processObjectUpdates(objinfo->obj, EV_UPDATED_MANUAL, true, false); + processObjectUpdates(objinfo->obj, EV_UPDATED_PERIODIC, true, false); elapsedMs = time.elapsed(); // Update timeToNextUpdateMs with the elapsed delay of sending the object; timeToNextUpdateMs += elapsedMs; @@ -522,6 +547,12 @@ void Telemetry::objectUpdatedManual(UAVObject* obj) processObjectUpdates(obj, EV_UPDATED_MANUAL, false, true); } +void Telemetry::objectUpdatedPeriodic(UAVObject* obj) +{ + QMutexLocker locker(mutex); + processObjectUpdates(obj, EV_UPDATED_PERIODIC, false, true); +} + void Telemetry::objectUnpacked(UAVObject* obj) { QMutexLocker locker(mutex); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.h b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.h index 62210e8da..f703f636b 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetry.h +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetry.h @@ -63,6 +63,7 @@ signals: private slots: void objectUpdatedAuto(UAVObject* obj); void objectUpdatedManual(UAVObject* obj); + void objectUpdatedPeriodic(UAVObject* obj); void objectUnpacked(UAVObject* obj); void updateRequested(UAVObject* obj); void newObject(UAVObject* obj); @@ -84,10 +85,12 @@ private: * Events generated by objects */ typedef enum { + EV_NONE = 0x00, /** No event */ EV_UNPACKED = 0x01, /** Object data updated by unpacking */ EV_UPDATED = 0x02, /** Object data updated by changing the data structure */ EV_UPDATED_MANUAL = 0x04, /** Object update event manually generated */ - EV_UPDATE_REQ = 0x08 /** Request to update object data */ + EV_UPDATED_PERIODIC = 0x8, /** Object update event generated by timer */ + EV_UPDATE_REQ = 0x010 /** Request to update object data */ } EventMask; typedef struct { @@ -132,7 +135,7 @@ private: void addObject(UAVObject* obj); void setUpdatePeriod(UAVObject* obj, qint32 periodMs); void connectToObjectInstances(UAVObject* obj, quint32 eventMask); - void updateObject(UAVObject* obj); + void updateObject(UAVObject* obj, quint32 eventMask); void processObjectUpdates(UAVObject* obj, EventMask event, bool allInstances, bool priority); void processObjectTransaction(); void processObjectQueue(); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp index 9bfed2109..881e1bc7d 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp @@ -77,25 +77,22 @@ void TelemetryMonitor::startRetrievingObjects() UAVMetaObject* mobj = dynamic_cast(obj); UAVDataObject* dobj = dynamic_cast(obj); UAVObject::Metadata mdata = obj->getMetadata(); - if ( mdata.gcsTelemetryUpdateMode != UAVObject::UPDATEMODE_NEVER ) + if ( mobj != NULL ) { - if ( mobj != NULL ) + queue.enqueue(obj); + } + else if ( dobj != NULL ) + { + if ( dobj->isSettings() ) { queue.enqueue(obj); } - else if ( dobj != NULL ) + else { - if ( dobj->isSettings() ) + if ( UAVObject::GetFlightTelemetryUpdateMode(mdata) == UAVObject::UPDATEMODE_ONCHANGE ) { queue.enqueue(obj); } - else - { - if ( mdata.flightTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE ) - { - queue.enqueue(obj); - } - } } } } diff --git a/ground/uavobjgenerator/generators/generator_common.cpp b/ground/uavobjgenerator/generators/generator_common.cpp index cd67b0899..34f097e44 100644 --- a/ground/uavobjgenerator/generators/generator_common.cpp +++ b/ground/uavobjgenerator/generators/generator_common.cpp @@ -38,7 +38,7 @@ void replaceCommonTags(QString& out, ObjectInfo* info) QStringList updateModeStr,accessModeStr; updateModeStr << "UPDATEMODE_PERIODIC" << "UPDATEMODE_ONCHANGE" - << "UPDATEMODE_MANUAL" << "UPDATEMODE_NEVER"; + << "UPDATEMODE_THROTTLED" << "UPDATEMODE_MANUAL"; accessModeStr << "ACCESS_READWRITE" << "ACCESS_READONLY"; diff --git a/ground/uavobjgenerator/uavobjectparser.cpp b/ground/uavobjgenerator/uavobjectparser.cpp index a0409f06f..29f71934c 100644 --- a/ground/uavobjgenerator/uavobjectparser.cpp +++ b/ground/uavobjgenerator/uavobjectparser.cpp @@ -34,7 +34,7 @@ UAVObjectParser::UAVObjectParser() fieldTypeStrXML << "int8" << "int16" << "int32" << "uint8" << "uint16" << "uint32" <<"float" << "enum"; - updateModeStrXML << "periodic" << "onchange" << "manual" << "never"; + updateModeStrXML << "periodic" << "onchange" << "throttled" << "manual"; accessModeStr << "ACCESS_READWRITE" << "ACCESS_READONLY"; diff --git a/ground/uavobjgenerator/uavobjectparser.h b/ground/uavobjgenerator/uavobjectparser.h index f1e93d8f5..f41c3ce30 100644 --- a/ground/uavobjgenerator/uavobjectparser.h +++ b/ground/uavobjgenerator/uavobjectparser.h @@ -66,8 +66,8 @@ typedef struct { typedef enum { UPDATEMODE_PERIODIC = 0, /** Automatically update object at periodic intervals */ UPDATEMODE_ONCHANGE, /** Only update object when its data changes */ - UPDATEMODE_MANUAL, /** Manually update object, by calling the updated() function */ - UPDATEMODE_NEVER /** Object is never updated */ + UPDATEMODE_THROTTLED, /** Object is updated on change, but not more often than the interval time */ + UPDATEMODE_MANUAL /** Manually update object, by calling the updated() function */ } UpdateMode; diff --git a/shared/uavobjectdefinition/accessorydesired.xml b/shared/uavobjectdefinition/accessorydesired.xml index d0a7b0ed8..dbeb583d9 100644 --- a/shared/uavobjectdefinition/accessorydesired.xml +++ b/shared/uavobjectdefinition/accessorydesired.xml @@ -5,6 +5,6 @@ - + diff --git a/shared/uavobjectdefinition/actuatorcommand.xml b/shared/uavobjectdefinition/actuatorcommand.xml index c0b65bbbc..a28b70df4 100644 --- a/shared/uavobjectdefinition/actuatorcommand.xml +++ b/shared/uavobjectdefinition/actuatorcommand.xml @@ -8,6 +8,6 @@ - + diff --git a/shared/uavobjectdefinition/actuatordesired.xml b/shared/uavobjectdefinition/actuatordesired.xml index f3ad47654..5b7b2f80e 100644 --- a/shared/uavobjectdefinition/actuatordesired.xml +++ b/shared/uavobjectdefinition/actuatordesired.xml @@ -10,6 +10,6 @@ - + diff --git a/shared/uavobjectdefinition/actuatorsettings.xml b/shared/uavobjectdefinition/actuatorsettings.xml index dd64dad15..66ae5d05c 100644 --- a/shared/uavobjectdefinition/actuatorsettings.xml +++ b/shared/uavobjectdefinition/actuatorsettings.xml @@ -30,6 +30,6 @@ - + diff --git a/shared/uavobjectdefinition/ahrscalibration.xml b/shared/uavobjectdefinition/ahrscalibration.xml index b56f86985..726b25f8b 100644 --- a/shared/uavobjectdefinition/ahrscalibration.xml +++ b/shared/uavobjectdefinition/ahrscalibration.xml @@ -18,6 +18,6 @@ - + diff --git a/shared/uavobjectdefinition/ahrssettings.xml b/shared/uavobjectdefinition/ahrssettings.xml index d5756cde8..4c98d050d 100644 --- a/shared/uavobjectdefinition/ahrssettings.xml +++ b/shared/uavobjectdefinition/ahrssettings.xml @@ -11,6 +11,6 @@ - + diff --git a/shared/uavobjectdefinition/attitudeactual.xml b/shared/uavobjectdefinition/attitudeactual.xml index 6db0e06b2..2d1d66a32 100644 --- a/shared/uavobjectdefinition/attitudeactual.xml +++ b/shared/uavobjectdefinition/attitudeactual.xml @@ -11,6 +11,6 @@ - + diff --git a/shared/uavobjectdefinition/attituderaw.xml b/shared/uavobjectdefinition/attituderaw.xml index 8a2a69ab7..9138d53d9 100644 --- a/shared/uavobjectdefinition/attituderaw.xml +++ b/shared/uavobjectdefinition/attituderaw.xml @@ -8,6 +8,6 @@ - + diff --git a/shared/uavobjectdefinition/attitudesettings.xml b/shared/uavobjectdefinition/attitudesettings.xml index e60c2454b..ca0ba9dc5 100644 --- a/shared/uavobjectdefinition/attitudesettings.xml +++ b/shared/uavobjectdefinition/attitudesettings.xml @@ -14,6 +14,6 @@ - + diff --git a/shared/uavobjectdefinition/baroaltitude.xml b/shared/uavobjectdefinition/baroaltitude.xml index aeabfc68c..8335b56dd 100644 --- a/shared/uavobjectdefinition/baroaltitude.xml +++ b/shared/uavobjectdefinition/baroaltitude.xml @@ -7,6 +7,6 @@ - + diff --git a/shared/uavobjectdefinition/cameradesired.xml b/shared/uavobjectdefinition/cameradesired.xml index 022728f7e..7d9cdbe64 100644 --- a/shared/uavobjectdefinition/cameradesired.xml +++ b/shared/uavobjectdefinition/cameradesired.xml @@ -7,6 +7,6 @@ - + diff --git a/shared/uavobjectdefinition/camerastabsettings.xml b/shared/uavobjectdefinition/camerastabsettings.xml index 069abdeb3..d6956c9fa 100644 --- a/shared/uavobjectdefinition/camerastabsettings.xml +++ b/shared/uavobjectdefinition/camerastabsettings.xml @@ -11,6 +11,6 @@ - + diff --git a/shared/uavobjectdefinition/faultsettings.xml b/shared/uavobjectdefinition/faultsettings.xml index 8d02f0d78..6750c4f99 100644 --- a/shared/uavobjectdefinition/faultsettings.xml +++ b/shared/uavobjectdefinition/faultsettings.xml @@ -7,6 +7,6 @@ - + diff --git a/shared/uavobjectdefinition/firmwareiapobj.xml b/shared/uavobjectdefinition/firmwareiapobj.xml index 51438395e..30b070857 100644 --- a/shared/uavobjectdefinition/firmwareiapobj.xml +++ b/shared/uavobjectdefinition/firmwareiapobj.xml @@ -11,7 +11,7 @@ - + diff --git a/shared/uavobjectdefinition/flightbatterysettings.xml b/shared/uavobjectdefinition/flightbatterysettings.xml index a7f796ea0..c95e7e817 100644 --- a/shared/uavobjectdefinition/flightbatterysettings.xml +++ b/shared/uavobjectdefinition/flightbatterysettings.xml @@ -14,6 +14,6 @@ - + diff --git a/shared/uavobjectdefinition/flightbatterystate.xml b/shared/uavobjectdefinition/flightbatterystate.xml index bc5310b8b..5cefbdd86 100644 --- a/shared/uavobjectdefinition/flightbatterystate.xml +++ b/shared/uavobjectdefinition/flightbatterystate.xml @@ -10,6 +10,6 @@ - + diff --git a/shared/uavobjectdefinition/flightplancontrol.xml b/shared/uavobjectdefinition/flightplancontrol.xml index bc9dbdfa6..f4412f74a 100644 --- a/shared/uavobjectdefinition/flightplancontrol.xml +++ b/shared/uavobjectdefinition/flightplancontrol.xml @@ -5,6 +5,6 @@ - + diff --git a/shared/uavobjectdefinition/flightplansettings.xml b/shared/uavobjectdefinition/flightplansettings.xml index d4c16ec7f..cd1464e8d 100644 --- a/shared/uavobjectdefinition/flightplansettings.xml +++ b/shared/uavobjectdefinition/flightplansettings.xml @@ -5,6 +5,6 @@ - + diff --git a/shared/uavobjectdefinition/flightplanstatus.xml b/shared/uavobjectdefinition/flightplanstatus.xml index fcf086d26..b5667de30 100644 --- a/shared/uavobjectdefinition/flightplanstatus.xml +++ b/shared/uavobjectdefinition/flightplanstatus.xml @@ -9,6 +9,6 @@ - + diff --git a/shared/uavobjectdefinition/flightstatus.xml b/shared/uavobjectdefinition/flightstatus.xml index 849e458d6..e3c0593f8 100644 --- a/shared/uavobjectdefinition/flightstatus.xml +++ b/shared/uavobjectdefinition/flightstatus.xml @@ -9,6 +9,6 @@ - + diff --git a/shared/uavobjectdefinition/gcsreceiver.xml b/shared/uavobjectdefinition/gcsreceiver.xml index d21598e48..ddf514087 100644 --- a/shared/uavobjectdefinition/gcsreceiver.xml +++ b/shared/uavobjectdefinition/gcsreceiver.xml @@ -4,7 +4,7 @@ - - + + diff --git a/shared/uavobjectdefinition/gcstelemetrystats.xml b/shared/uavobjectdefinition/gcstelemetrystats.xml index 3f9c74b1b..3971cffba 100644 --- a/shared/uavobjectdefinition/gcstelemetrystats.xml +++ b/shared/uavobjectdefinition/gcstelemetrystats.xml @@ -10,6 +10,6 @@ - + diff --git a/shared/uavobjectdefinition/guidancesettings.xml b/shared/uavobjectdefinition/guidancesettings.xml index 5d83f92e5..56149204a 100644 --- a/shared/uavobjectdefinition/guidancesettings.xml +++ b/shared/uavobjectdefinition/guidancesettings.xml @@ -14,6 +14,6 @@ - + diff --git a/shared/uavobjectdefinition/homelocation.xml b/shared/uavobjectdefinition/homelocation.xml index c1ed6a5b8..893af7e30 100644 --- a/shared/uavobjectdefinition/homelocation.xml +++ b/shared/uavobjectdefinition/homelocation.xml @@ -12,6 +12,6 @@ - + diff --git a/shared/uavobjectdefinition/hwsettings.xml b/shared/uavobjectdefinition/hwsettings.xml index 1327c8d69..592b04861 100644 --- a/shared/uavobjectdefinition/hwsettings.xml +++ b/shared/uavobjectdefinition/hwsettings.xml @@ -22,6 +22,6 @@ - + diff --git a/shared/uavobjectdefinition/manualcontrolcommand.xml b/shared/uavobjectdefinition/manualcontrolcommand.xml index d8dba78d6..00b5f0a12 100644 --- a/shared/uavobjectdefinition/manualcontrolcommand.xml +++ b/shared/uavobjectdefinition/manualcontrolcommand.xml @@ -11,6 +11,6 @@ - + diff --git a/shared/uavobjectdefinition/manualcontrolsettings.xml b/shared/uavobjectdefinition/manualcontrolsettings.xml index 14a92a6cb..617f7ac75 100644 --- a/shared/uavobjectdefinition/manualcontrolsettings.xml +++ b/shared/uavobjectdefinition/manualcontrolsettings.xml @@ -29,6 +29,6 @@ - + diff --git a/shared/uavobjectdefinition/mixersettings.xml b/shared/uavobjectdefinition/mixersettings.xml index e2df02ce0..6e0d519f1 100644 --- a/shared/uavobjectdefinition/mixersettings.xml +++ b/shared/uavobjectdefinition/mixersettings.xml @@ -31,6 +31,6 @@ - + diff --git a/shared/uavobjectdefinition/nedaccel.xml b/shared/uavobjectdefinition/nedaccel.xml index 83da85e7e..9e278671f 100644 --- a/shared/uavobjectdefinition/nedaccel.xml +++ b/shared/uavobjectdefinition/nedaccel.xml @@ -7,6 +7,6 @@ - + diff --git a/shared/uavobjectdefinition/objectpersistence.xml b/shared/uavobjectdefinition/objectpersistence.xml index aa7a58e8c..afeb2ff24 100644 --- a/shared/uavobjectdefinition/objectpersistence.xml +++ b/shared/uavobjectdefinition/objectpersistence.xml @@ -8,6 +8,6 @@ - + diff --git a/shared/uavobjectdefinition/receiveractivity.xml b/shared/uavobjectdefinition/receiveractivity.xml index c2a741d7f..8e30e0889 100644 --- a/shared/uavobjectdefinition/receiveractivity.xml +++ b/shared/uavobjectdefinition/receiveractivity.xml @@ -9,6 +9,6 @@ - + diff --git a/shared/uavobjectdefinition/sonaraltitude.xml b/shared/uavobjectdefinition/sonaraltitude.xml index 9c52bda24..98b678413 100644 --- a/shared/uavobjectdefinition/sonaraltitude.xml +++ b/shared/uavobjectdefinition/sonaraltitude.xml @@ -5,6 +5,6 @@ - + diff --git a/shared/uavobjectdefinition/stabilizationdesired.xml b/shared/uavobjectdefinition/stabilizationdesired.xml index c1e013be3..21138c2e3 100644 --- a/shared/uavobjectdefinition/stabilizationdesired.xml +++ b/shared/uavobjectdefinition/stabilizationdesired.xml @@ -10,6 +10,6 @@ - + diff --git a/shared/uavobjectdefinition/stabilizationsettings.xml b/shared/uavobjectdefinition/stabilizationsettings.xml index 29c9d8116..de1c92daa 100644 --- a/shared/uavobjectdefinition/stabilizationsettings.xml +++ b/shared/uavobjectdefinition/stabilizationsettings.xml @@ -27,6 +27,6 @@ - + diff --git a/shared/uavobjectdefinition/systemsettings.xml b/shared/uavobjectdefinition/systemsettings.xml index ec092df8e..249c2336d 100644 --- a/shared/uavobjectdefinition/systemsettings.xml +++ b/shared/uavobjectdefinition/systemsettings.xml @@ -6,6 +6,6 @@ - + diff --git a/shared/uavobjectdefinition/txpidsettings.xml b/shared/uavobjectdefinition/txpidsettings.xml index 876ffccc7..bdc05ba33 100644 --- a/shared/uavobjectdefinition/txpidsettings.xml +++ b/shared/uavobjectdefinition/txpidsettings.xml @@ -24,6 +24,6 @@ - +