This is a work in progress in order to assemble a lightweight and
open serial protocol for generic Video TX, Camera and OSD control.
I am going to implement this on my upcoming tinyOSD project.
This is a draft and open for discussion. Please fork this repo and submit a pull request for discussion.
[HEADER:8 0x80] [DEVICE_ID:4 COMMAND:4] ..data.. [CRC:8]
The total frame length is variable in order to efficiently allow short commands. Using CRC8 as a checksum should be sufficient as we do not send packets longer than 64 bytes. (or do we?)
- 0x0 = generic OSD
- 0x1 = generic Vtx
- 0x2 = generic Camera
- 0x3 ... 0xF reserved for now
COMMANDS < 0x8 will have a fixed length
COMMANDS >= 0x8 will have variable length (byte 2 = length)
set flags such as enable, video format,...
packet length: 4 frame format: [0x80] [0x00] [FLAGS:8] [CRC:8]
- bit 0 : enable osd
- bit 1+2 : video format (0 = auto, 1 = pal, 2 = ntsc, 3 = reserved)
- bit 3..7 : reserved
fill the whole screen with the given value
packet length: 4 frame format: [0x80] [0x01] [VALUE:8] [CRC:8]
Set a single character to a given value packet length: 6 frame format: [0x80] [0x02] [X:8] [Y:8] [VALUE:8] [CRC:8]
Write n characters to the given position with horizontal auto increment.
packet length: 4 + DATA{2} frame format: [0x80] [0x08] [LEN:8] [X:8] [Y:8] [LEN-2*DATA:8] [CRC:8] with LEN = 0..60 (as the serial buffer is 64 bytes)
The x position will auto increment for every byte in the buffer, y position will increment when the end of line is reached and x is set to zero.
Write n characters to the given position with vertical auto increment.
packet length: 4 + DATA{2} frame format: [0x80] [0x09] [LEN:8] [X:8] [Y:8] [LEN-2*DATA:8] [CRC:8] with LEN = 1..60 (as the serial buffer is 64 bytes)
The y position will auto increment for every byte in the buffer, x position will increment when the end of line is reached and y is set to zero.
special commands for gui effects (stick positions, render a spectrum, ...)
packet length: 4 + DATA{2} frame format: [0x80] [0x0F] [LEN:8] [SPECIAL_CMD:8] ... [CRC:8]
SPECIAL_COMMAND:
- 0x00 : sticks and state, LEN=5, DATA = [A:8] [E:8] [T:8] [R:8] [FC_STATE:8]
- 0x01..0xFF reserved
- this protocol is meant to be bi-directional, further improvements will follow.
- missing command for font, custom logo / graphic upload
- missing command for enter bootloader (fw upgrades)
This is open for discussion, should be similar to OSD
This is open for discussion, should be similar to OSD