Add TXRSSI and TXLQI sensors to FrSky D8/D16/LBT when using MULTI (#7128)
[opentx.git] / radio / util / dsm2.py
blobede55621117f63b9ef77570c18e1b0d44e4e1e04
1 from __future__ import print_function
3 BITLEN_DSM2 = 16
6 def sendByteDsm2(b):
7 print("%02x:" % b, end=' ')
8 lev = 0
9 len = BITLEN_DSM2
10 for i in range(9):
11 nlev = b & 1
12 if lev == nlev:
13 len += BITLEN_DSM2
14 else:
15 print(len, end=' ')
16 # _send_1(nlev ? len-5 : len+3);
17 len = BITLEN_DSM2
18 lev = nlev
19 b = (b >> 1) | 0x80
20 # _send_1(len+BITLEN_DSM2+3); // 2 stop bits
21 print(len + BITLEN_DSM2)
24 sendByteDsm2(24)
25 sendByteDsm2(17)
26 sendByteDsm2(2)
27 sendByteDsm2(0x00)
28 sendByteDsm2(0x06)
29 sendByteDsm2(0)
30 sendByteDsm2(10)
31 sendByteDsm2(0)
32 sendByteDsm2(14)
33 sendByteDsm2(0)
34 sendByteDsm2(18)
35 sendByteDsm2(0)
36 sendByteDsm2(22)
37 sendByteDsm2(0)