dRonin
adbada4
dRonin firmware
|
Files | |
file | telemetry.c |
Telemetry module, handles telemetry and UAVObject updates. | |
Data Structures | |
struct | pending_ack |
struct | pending_req |
struct | telemetry_state |
Macros | |
#define | TELEM_QUEUE_SIZE 60 |
#define | TELEM_STACK_SIZE 624 |
#define | MAX_QUEUE_SIZE TELEM_QUEUE_SIZE |
#define | STACK_SIZE_BYTES TELEM_STACK_SIZE |
#define | TASK_PRIORITY_RX PIOS_THREAD_PRIO_NORMAL |
#define | TASK_PRIORITY_TX PIOS_THREAD_PRIO_NORMAL |
#define | MAX_RETRIES 2 |
#define | STATS_UPDATE_PERIOD_MS 1753 |
#define | CONNECTION_TIMEOUT_MS 8000 |
#define | USB_ACTIVITY_TIMEOUT_MS 6000 |
#define | MAX_ACKS_PENDING 3 |
#define | MAX_REQS_PENDING 5 |
#define | ACK_TIMEOUT_MS 250 |
Typedefs | |
typedef struct telemetry_state * | telem_t |
Functions | |
static void | telemetryTxTask (void *parameters) |
static void | telemetryRxTask (void *parameters) |
static int32_t | transmitData (void *ctx, uint8_t *data, int32_t length) |
static void | addAckPending (telem_t telem, UAVObjHandle obj, uint16_t inst_id) |
static void | ackCallback (void *ctx, uint32_t obj_id, uint16_t inst_id) |
static void | reqCallback (void *ctx, uint32_t obj_id, uint16_t inst_id) |
static void | registerObject (telem_t telem, UAVObjHandle obj) |
static void | updateObject (telem_t telem, UAVObjHandle obj, int32_t eventType) |
static int32_t | setUpdatePeriod (telem_t telem, UAVObjHandle obj, int32_t updatePeriodMs) |
static void | processObjEvent (telem_t telem, UAVObjEvent *ev) |
static void | updateTelemetryStats (telem_t telem) |
static void | gcsTelemetryStatsUpdated () |
static void | updateSettings () |
static uintptr_t | getComPort () |
static void | update_object_instances (uint32_t obj_id, uint32_t inst_id) |
static bool | processUsbActivity (bool seen_active) |
static int32_t | fileReqCallback (void *ctx, uint8_t *buf, uint32_t file_id, uint32_t offset, uint32_t len) |
static void | registerObjectShim (UAVObjHandle obj) |
int32_t | TelemetryStart (void) |
int32_t | TelemetryInitialize (void) |
static void | ackResendOrTimeout (telem_t telem, int idx) |
static bool | ackHousekeeping (telem_t telem) |
static bool | sendRequestedObjs (telem_t telem) |
static void | gcsTelemetryStatsUpdated (telem_t telem) |
void | telemetry_set_inhibit (bool inhibit) |
Variables | |
static struct telemetry_state | telem_state = { } |
#define ACK_TIMEOUT_MS 250 |
Definition at line 73 of file telemetry.c.
#define CONNECTION_TIMEOUT_MS 8000 |
Definition at line 68 of file telemetry.c.
#define MAX_ACKS_PENDING 3 |
Definition at line 71 of file telemetry.c.
#define MAX_QUEUE_SIZE TELEM_QUEUE_SIZE |
Definition at line 61 of file telemetry.c.
#define MAX_REQS_PENDING 5 |
Definition at line 72 of file telemetry.c.
#define MAX_RETRIES 2 |
Definition at line 65 of file telemetry.c.
#define STACK_SIZE_BYTES TELEM_STACK_SIZE |
Definition at line 62 of file telemetry.c.
#define STATS_UPDATE_PERIOD_MS 1753 |
Definition at line 67 of file telemetry.c.
#define TASK_PRIORITY_RX PIOS_THREAD_PRIO_NORMAL |
Definition at line 63 of file telemetry.c.
#define TASK_PRIORITY_TX PIOS_THREAD_PRIO_NORMAL |
Definition at line 64 of file telemetry.c.
#define TELEM_QUEUE_SIZE 60 |
Definition at line 53 of file telemetry.c.
#define TELEM_STACK_SIZE 624 |
Definition at line 57 of file telemetry.c.
#define USB_ACTIVITY_TIMEOUT_MS 6000 |
Definition at line 69 of file telemetry.c.
typedef struct telemetry_state* telem_t |
Definition at line 113 of file telemetry.c.
|
static |
Callback for when we receive an ack.
[in] | ctx | Callback context (telemetry subsystem handle) |
[in] | obj_id | The object ID that we got an ack for. |
[in] | inst_id | The instance ID that we got an ack for. |
Definition at line 520 of file telemetry.c.
|
static |
Checks for expected-ack messages that need resend or expiration.
[in] | telem | Telemetry subsystem handle |
Definition at line 356 of file telemetry.c.
|
static |
Either expires or retransmits a message that expects ack.
[in] | telem | Telemetry subsystem handle |
[in] | idx | The offset for "which ack" to do this for. |
Definition at line 310 of file telemetry.c.
|
static |
Adds a message for which we want an ack. Can block if there are already too many ack-required things pending.
[in] | telem | Telemetry subsystem handle |
[in] | obj | The object for which we want to wait for an ack. |
[in] | inst_id | The instance ID of said object. |
Definition at line 383 of file telemetry.c.
|
static |
Callback for when we receive a request for data. Converts a file id to the actual unit of information, and returns/copies it. Currently only operates on partitions.
[in] | ctx | Callback context (telemetry subsystem handle) |
[in] | file_id | The requested file_id |
[in] | offset | The offset of information requested |
[in] | len | The maximum amount of information to return. A short read is permissable, as long as some bytes are returned. |
Definition at line 439 of file telemetry.c.
|
static |
|
static |
Called each time the GCS telemetry stats object is updated. Trigger a flight telemetry stats update if a connection is not yet established.
Definition at line 780 of file telemetry.c.
|
static |
Determine input/output com port as highest priority available
Definition at line 938 of file telemetry.c.
|
static |
Processes queue events
Definition at line 556 of file telemetry.c.
|
static |
|
static |
Register a new object, adds object to local list and connects the queue depending on the object's telemetry settings.
[in] | obj | Object to connect |
Definition at line 217 of file telemetry.c.
|
static |
Definition at line 138 of file telemetry.c.
|
static |
Callback for when a telemetry session requests data
[in] | ctx | Callback context (telemetry subsystem handle) |
[in] | obj_id | The object ID that we got a req for. |
[in] | inst_id | The instance ID that we got a req for. |
Definition at line 488 of file telemetry.c.
|
static |
Definition at line 603 of file telemetry.c.
|
static |
Set update period of object (it must be already setup for periodic updates)
[in] | obj | The object to update |
[in] | updatePeriodMs | The update period in ms, if zero then periodic updates are disabled |
Definition at line 763 of file telemetry.c.
void telemetry_set_inhibit | ( | bool | inhibit | ) |
Definition at line 981 of file telemetry.c.
int32_t TelemetryInitialize | ( | void | ) |
Initialise the telemetry module
Definition at line 181 of file telemetry.c.
|
static |
Telemetry transmit task. Processes queue events and periodic updates.
Definition at line 702 of file telemetry.c.
int32_t TelemetryStart | ( | void | ) |
Initialise the telemetry module
Definition at line 147 of file telemetry.c.
|
static |
Telemetry transmit task
Definition at line 659 of file telemetry.c.
|
static |
Transmit data buffer to the modem or USB port.
[in] | data | Data buffer to send |
[in] | length | Length of buffer |
Definition at line 744 of file telemetry.c.
|
static |
New UAVO object instance callback This is called from the uavobjectmanager
[in] | obj_id | The id of the object which had a new instance created |
[in] | inst_id | the instance ID that was created |
Definition at line 976 of file telemetry.c.
|
static |
Update object's queue connections and timer, depending on object's settings
[in] | obj | Object to updates |
Definition at line 250 of file telemetry.c.
|
static |
Update the telemetry settings, called on startup.
Definition at line 891 of file telemetry.c.
|
static |
Update telemetry statistics and handle connection handshake
Definition at line 797 of file telemetry.c.
|
static |
Definition at line 111 of file telemetry.c.