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

Function appendConfiguration

src/python/UnifiedConfiguration.py:122–150  ·  view source on GitHub ↗
(source, target, env)

Source from the content-addressed store, hash-verified

120 appendToFirmware(file, product_name, lua_name, defines, config, layout, rx_as_tx)
121
122def appendConfiguration(source, target, env):
123 target_name = env.get('PIOENV', '').upper()
124 device_name = env.get('DEVICE_NAME', None)
125 config = env.GetProjectOption('board_config', None)
126 if 'UNIFIED_' not in target_name and config is None:
127 return
128
129 moduletype = ''
130 frequency = ''
131 if config is not None:
132 moduletype = 'tx' if '.tx_' in config else 'rx'
133 frequency = '2400' if '_2400.' in config else '900' if '_900.' in config else 'dual'
134 else:
135 moduletype = 'tx' if '_TX_' in target_name else 'rx'
136 frequency = '2400' if '_2400_' in target_name else '900' if '_900_' in target_name else 'dual'
137
138 if env.get('PIOPLATFORM', '') == 'espressif32':
139 platform = 'esp32'
140 if 'esp32-s3' in env.get('BOARD', ''):
141 platform = 'esp32-s3'
142 elif 'esp32-c3' in env.get('BOARD', ''):
143 platform = 'esp32-c3'
144 else:
145 platform = 'esp8285'
146
147 defines = json.JSONEncoder().encode(env['OPTIONS_JSON'])
148
149 with open(str(target[0]), "r+b") as firmware_file:
150 doConfiguration(firmware_file, defines, config, moduletype, frequency, platform, device_name, None)
151
152if __name__ == '__main__':
153 parser = argparse.ArgumentParser(description="Configure Unified Firmware")

Callers

nothing calls this directly

Calls 2

doConfigurationFunction · 0.85
encodeMethod · 0.45

Tested by

no test coverage detected