From a641cd79566c00ea9ecbcd0a9b0cd210c469d243 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Wed, 3 Aug 2011 00:00:50 -0400 Subject: [PATCH] uavobj: shrink metadata struct to save RAM This update saves 448 bytes of RAM with the current crop of UAVObjects. It reduces a 19 byte struct to 8 bytes. Note: This also introduces a limit of 65.534s for the update periods. --- flight/UAVObjects/inc/uavobjectmanager.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/flight/UAVObjects/inc/uavobjectmanager.h b/flight/UAVObjects/inc/uavobjectmanager.h index ac5d34b5c..600522420 100644 --- a/flight/UAVObjects/inc/uavobjectmanager.h +++ b/flight/UAVObjects/inc/uavobjectmanager.h @@ -59,16 +59,20 @@ typedef enum { * properties for each object and can be used by multiple modules (e.g. telemetry and logger) */ 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 access : 1; /** Defines the access level for the local transactions (readonly and readwrite) */ + uint8_t gcsAccess : 1; /** Defines the access level for the local GCS transactions (readonly and readwrite), not used in the flight s/w */ + uint8_t telemetryAcked : 1; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ + uint8_t gcsTelemetryAcked : 1; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ + uint8_t : 4; + + uint8_t telemetryUpdateMode : 2; /** Update mode used by the telemetry module (UAVObjUpdateMode) */ + uint8_t gcsTelemetryUpdateMode : 2; /** Update mode used by the GCS (UAVObjUpdateMode) */ + uint8_t loggingUpdateMode : 2; /** Update mode used by the logging module (UAVObjUpdateMode) */ + uint8_t : 2; + + uint16_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ + uint16_t telemetryUpdatePeriod; /** Update period used by the telemetry module (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; /**