From 722cc03f8fe413dd4b083299869c0f5eee6a7d78 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Thu, 13 Jun 2024 17:18:56 +1000 Subject: [PATCH] param_auto_test: fix bitmask check SW-159 --- Tools/Carbonix_scripts/param_auto_test.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Tools/Carbonix_scripts/param_auto_test.py b/Tools/Carbonix_scripts/param_auto_test.py index cdf98ded60..8e3124078f 100644 --- a/Tools/Carbonix_scripts/param_auto_test.py +++ b/Tools/Carbonix_scripts/param_auto_test.py @@ -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 "