Skip to content

Commit

Permalink
FEATURE: Support bitmasks in the component editor
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed May 11, 2024
1 parent e3bc78d commit f7e1252
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion MethodicConfigurator/ArduCopter_configuration_steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
"external_tool_text": "EdgeTX Companion",
"external_tool_url": "https://edgetx.org/getedgetx/",
"mandatory_text": "100% mandatory (0% optional)",
"auto_changed_by": ""
"auto_changed_by": "",
"derived_parameters": {
"RC_PROTOCOLS": { "New Value": "vehicle_components['RC Receiver']['FC Connection']['Protocol']", "Change Reason": "Selected in the component editor" }
}
},
"06_telemetry.param": {
"blog_text": "Sets up telemetry parameters for data transmission, including GPS, altitude, and other flight metrics.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ def compute_parameters(self, filename: str, file_info: dict, parameter_type: str
if isinstance(result, str):
if parameter in variables['doc_dict']:
values = variables['doc_dict'][parameter]['values']
result = next(key for key, value in values.items() if value == result)
if values:
result = next(key for key, value in values.items() if value == result)
else:
bitmasks = variables['doc_dict'][parameter]['Bitmask']
if bitmasks:
result = 2**next(key for key, bitmask in bitmasks.items() if bitmask == result)

if filename not in destination:
destination[filename] = {}
Expand Down

0 comments on commit f7e1252

Please sign in to comment.