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

Function generateUID

src/python/binary_configurator.py:33–44  ·  view source on GitHub ↗
(phrase)

Source from the content-addressed store, hash-verified

31 return self.value
32
33def generateUID(phrase):
34 uid = [
35 int(item) if item.isdigit() else -1
36 for item in phrase.split(',')
37 ]
38 if (4 <= len(uid) <= 6) and all(ele >= 0 and ele < 256 for ele in uid):
39 # Extend the UID to 6 bytes, as only 4 are needed to bind
40 uid = [0] * (6 - len(uid)) + uid
41 uid = bytes(uid)
42 else:
43 uid = hashlib.md5(("-DMY_BINDING_PHRASE=\""+phrase+"\"").encode()).digest()[0:6]
44 return uid
45
46def FREQ_HZ_TO_REG_VAL_SX127X(freq):
47 return int(freq/61.03515625)

Callers 1

patch_unifiedFunction · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected