Skip to content

Commit

Permalink
param_auto_test: fix bitmask check
Browse files Browse the repository at this point in the history
SW-159
  • Loading branch information
robertlong13 authored and loki077 committed Jun 14, 2024
1 parent 5ed191e commit 722cc03
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Tools/Carbonix_scripts/param_auto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,16 @@
)
return_status = 1
elif param_type == 'bitmask':
# Check if the parameter value is in the list of values
if param_value not in param_values:
print(
f"Parameter '{param_name}' has an "
f"invalid value: {param_value}"
)
return_status = 1
# Check if the all set bits correspond to something
param_value = int(param_value)
for i in range(32):
if (param_value >> i) & 1:
if i not in param_values:
print(
f"Parameter '{param_name}' has an "
f"invalid bitmask value: {param_value}"
)
return_status = 1
else:
print(
f"Parameter '{param_name}' has no "
Expand Down

0 comments on commit 722cc03

Please sign in to comment.