Skip to content

Commit 2339d65

Browse files
committed
BUGFIX: Support unknown flight controller capabilities bits gracefully
1 parent a0f7fe8 commit 2339d65

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

MethodicConfigurator/backend_flightcontroller_info.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,12 @@ def __decode_flight_capabilities(capabilities):
144144
if capabilities & (1 << bit):
145145
# Use the bit value to get the corresponding capability enum
146146
capability = mavutil.mavlink.enums["MAV_PROTOCOL_CAPABILITY"].get(1 << bit, "Unknown capability")
147-
# Append the abbreviated name and description of the capability dictionary
148-
capabilities_dict[capability.name.replace("MAV_PROTOCOL_CAPABILITY_", "")] = capability.description
147+
148+
if hasattr(capability, 'description'):
149+
# Append the abbreviated name and description of the capability dictionary
150+
capabilities_dict[capability.name.replace("MAV_PROTOCOL_CAPABILITY_", "")] = capability.description
151+
else:
152+
capabilities_dict[f'BIT{bit}'] = capability
149153

150154
return capabilities_dict
151155

0 commit comments

Comments
 (0)