Skip to content

Commit

Permalink
Update update_devices.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzroe authored Dec 1, 2024
1 parent 2659dfc commit 2fb5f77
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/scripts/update_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ def parse_brd_configs(hw_content):
pattern = re.compile(r'BrdConfigStruct brdConfigs\[\] = \{(.*?)\};', re.DOTALL)
match = pattern.search(hw_content)
if match:
print("Found brdConfigs")
print("Found brdConfigs:")
print (match.group(1))
return match.group(1)
print("brdConfigs not found")
return ""

def extract_devices(brd_configs, mist_configs):
devices = []
device_pattern = re.compile(r'\{\s*"([^"]+)",\s*\.ethConfigIndex = (-?\d+),\s*\.zbConfigIndex = -?\d+,\s*\.mistConfigIndex = (-?\d+)\s*\}', re.DOTALL)
# device_pattern = re.compile(r'\{\s*"([^"]+)",\s*\.ethConfigIndex = (-?\d+),\s*\.zbConfigIndex = -?\d+,\s*\.mistConfigIndex = (-?\d+)\s*\}', re.DOTALL)
# new style {"SLS-classic", -1, 7, 3}, // 0
device_pattern = re.compile(r'\{\s*"([^"]+)",\s*(-?\d+),\s*(-?\d+),\s*(-?\d+)\s*\}', re.DOTALL)
for device_match in device_pattern.finditer(brd_configs):
print(f"Found device: {device_match.group(1)}, ethConfigIndex: {device_match.group(2)}, zbConfigIndex: {device_match.group(3)}, mistConfigIndex: {device_match.group(4)}")

device_name = device_match.group(1)
eth_config_index = int(device_match.group(2))
mist_config_index = int(device_match.group(3))
mist_config_index = int(device_match.group(4))

eth_is = eth_config_index > -1
btn_is = mist_configs[mist_config_index]['btnPin'] > -1
Expand Down

0 comments on commit 2fb5f77

Please sign in to comment.