Skip to content

Commit

Permalink
chibios_hwdef.py: correct extraction of intdefines from hwdef files
Browse files Browse the repository at this point in the history
many of our hwdef files contain lines which look like this:

define STM32_PWM_USE_ADVANCED TRUE

The current regex does not allow for numbers in those define, so the regex ends up matching "STM" as a name....

the "intdefines" hash which is populated from these is only used internally to chibios_hwdey.py for logic purposes, not directly in hwdef output purposes, and none of the strings which it looks at contain numbers at the moment, so this is a non-functional change.
  • Loading branch information
peterbarker committed Mar 22, 2024
1 parent aa8b48b commit bc28efb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -3072,7 +3072,7 @@ def process_line(self, line):
self.env_vars[name] = value
elif a[0] == 'define':
# extract numerical defines for processing by other parts of the script
result = re.match(r'define\s*([A-Z_]+)\s*([0-9]+)', line)
result = re.match(r'define\s*([A-Z_0-9]+)\s*([0-9]+)', line)
if result:
self.intdefines[result.group(1)] = int(result.group(2))

Expand Down

0 comments on commit bc28efb

Please sign in to comment.