dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
telemetry.c File Reference

Telemetry module, handles telemetry and UAVObject updates. More...

#include "openpilot.h"
#include <eventdispatcher.h>
#include "flighttelemetrystats.h"
#include "gcstelemetrystats.h"
#include "modulesettings.h"
#include "pios_thread.h"
#include "pios_mutex.h"
#include "pios_queue.h"
#include "pios_hal.h"
#include <uavtalk.h>

Go to the source code of this file.

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_statetelem_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 = { }
 

Detailed Description

Telemetry module, handles telemetry and UAVObject updates.

Author
The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
Tau Labs, http://taulabs.org, Copyright (C) 2012-2014
dRonin, http://dronin.org Copyright (C) 2015-2016
See Also
The GNU Public License (GPL) Version 3

Definition in file telemetry.c.