MCPcopy Create free account
hub / github.com/ExpressLRS/ExpressLRS / process

Function process

src/python/crsf.py:54–98  ·  view source on GitHub ↗
(command: bytes)

Source from the content-addressed store, hash-verified

52
53
54def process(command: bytes):
55 if command[0] == 0x14: # Link Stats
56 None
57 elif command[0] == 0x16: # RC Packet
58 None
59 elif command[0] >= 0x28:
60 type = command[0]
61 print('Type: ' + hex(type))
62 print('Dest: ' + device_name(command[1]))
63 print('Orig: ' + device_name(command[2]))
64 command = command[3:]
65 if type == 0x29: # Parameter Device Info
66 zero = command.index(0)
67 print('Name: ' + str(command[:zero]))
68 command = command[zero+1:]
69 serial_number = command[:4]
70 command = command[4:]
71 print('Serial Number: ' + str(serial_number))
72 hardware_id = command[:4]
73 print('Hardware ID: ' + str(hardware_id))
74 command = command[4:]
75 software_id = command[:4]
76 print('Software ID: ' + str(software_id))
77 command = command[4:]
78 total_params = command[0]
79 print('Total params: ' + str(total_params))
80 command = command[1:]
81 parameter_version = command[0]
82 print('Parameter Version: ' + str(parameter_version))
83 command = command[1:]
84 elif type == 0x2B:
85 global data, next_chunk
86 param = command[0]
87 print('Param: ', param)
88 chunks_remaining = command[1]
89 print('Chunks remaining: ', chunks_remaining)
90 data = data + command[2:]
91 if chunks_remaining != 0:
92 read_param(s, param, next_chunk)
93 else:
94 print('Data: ', data)
95 else:
96 print(command)
97 else:
98 print(command)
99
100
101def reader(s: serial.Serial):

Callers 1

readerFunction · 0.85

Calls 2

device_nameFunction · 0.85
read_paramFunction · 0.85

Tested by

no test coverage detected