CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Frsky_Telem/AP_Frsky_MAVlite.h
Views: 1798
1
#pragma once
2
#include "AP_Frsky_Backend.h"
3
4
/*
5
6
Wire Protocol:
7
8
Several SPort packets make up a MAVlite message.
9
10
A maximum of six relevant data bytes are present in an SPort packet.
11
12
Each SPort packet starts with a sequence number, starting with zero.
13
14
If the sequence number is zero then the parser is reset.
15
16
The first sport packet contains len at offset 1. It is the
17
*payload* length - does not include checksum, for example. msgid is
18
at offset 2, then payload bytes.
19
20
Subsequent SPort packets contain a sequence number at offset zero,
21
followed by more payload bytes.
22
23
When sufficient payload bytes have been received (based on "len"), a
24
single checksum byte arrives. Sometimes this checksum byte goes
25
into an SPort packet all on its own, sharing space only with the
26
sequence number.
27
28
*/
29
30
#define MAVLITE_MAX_PAYLOAD_LEN 31 // 7 float params + cmd_id + options
31
#define MAVLITE_MSG_SPORT_PACKETS_COUNT(LEN) static_cast<uint8_t>(1 + ceilf((LEN-2)/5.0f)) // number of sport packets required to transport a message with LEN payload
32
#define SPORT_PACKET_QUEUE_LENGTH static_cast<uint8_t>(30U*MAVLITE_MSG_SPORT_PACKETS_COUNT(MAVLITE_MAX_PAYLOAD_LEN))
33
34