(phrase)
| 31 | return self.value |
| 32 | |
| 33 | def 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 | |
| 46 | def FREQ_HZ_TO_REG_VAL_SX127X(freq): |
| 47 | return int(freq/61.03515625) |