(define)
| 34 | return str |
| 35 | |
| 36 | def process_json_flag(define): |
| 37 | parts = re.search(r"-D(.*)\s*=\s*(.*)$", define) |
| 38 | if parts and define.startswith("-D"): |
| 39 | if parts.group(1) == "MY_BINDING_PHRASE": |
| 40 | json_flags['uid'] = [x for x in hashlib.md5(define.encode()).digest()[0:6]] |
| 41 | if parts.group(1) == "HOME_WIFI_SSID": |
| 42 | json_flags['wifi-ssid'] = dequote(parts.group(2)) |
| 43 | if parts.group(1) == "HOME_WIFI_PASSWORD": |
| 44 | json_flags['wifi-password'] = dequote(parts.group(2)) |
| 45 | if parts.group(1) == "AUTO_WIFI_ON_INTERVAL": |
| 46 | parts = re.search(r"-D(.*)\s*=\s*\"?([0-9]+).*\"?$", define) |
| 47 | json_flags['wifi-on-interval'] = int(dequote(parts.group(2))) |
| 48 | if parts.group(1) == "TLM_REPORT_INTERVAL_MS" and not isRX: |
| 49 | parts = re.search(r"-D(.*)\s*=\s*\"?([0-9]+).*\"?$", define) |
| 50 | json_flags['tlm-interval'] = int(dequote(parts.group(2))) |
| 51 | if parts.group(1) == "FAN_MIN_RUNTIME" and not isRX: |
| 52 | parts = re.search(r"-D(.*)\s*=\s*\"?([0-9]+).*\"?$", define) |
| 53 | json_flags['fan-runtime'] = int(dequote(parts.group(2))) |
| 54 | if parts.group(1) == "RCVR_UART_BAUD" and isRX: |
| 55 | parts = re.search(r"-D(.*)\s*=\s*\"?([0-9]+).*\"?$", define) |
| 56 | json_flags['rcvr-uart-baud'] = int(dequote(parts.group(2))) |
| 57 | if parts.group(1) == "USE_AIRPORT_AT_BAUD": |
| 58 | parts = re.search(r"-D(.*)\s*=\s*\"?([0-9]+).*\"?$", define) |
| 59 | json_flags['is-airport'] = True |
| 60 | if isRX: |
| 61 | json_flags['rcvr-uart-baud'] = int(dequote(parts.group(2))) |
| 62 | else: |
| 63 | json_flags['airport-uart-baud'] = int(dequote(parts.group(2))) |
| 64 | if define == "-DUNLOCK_HIGHER_POWER" and not isRX: |
| 65 | json_flags['unlock-higher-power'] = True |
| 66 | if define == "-DLOCK_ON_FIRST_CONNECTION" and isRX: |
| 67 | json_flags['lock-on-first-connection'] = True |
| 68 | |
| 69 | def process_build_flag(define): |
| 70 | if define.startswith("-D") or define.startswith("!-D"): |
no test coverage detected