mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 22:22:11 +08:00
852166f5cc
3ca654f move acura rdx to generator folder 1c7c490 move pilot touring to generated 89856dd fix bugs in some counter/checksum definitions 451a2b4 honda wheelspeed in kph to match toyota 290dd14 rename generic honda and toyota dbcs to include year ccb8a14 readded gas interceptor to hondas so it does not break regression tests 66d256e readme explanation of preprocessor 6c8d9f7 regenerate new steer torque eps factor beba6d5 move generated files to root folder 2b5b0aa Toyota: different factor for STEER_TORQUE_EPS e41b174 fix typo 682f557 cleanup 1faf67c fix crv steering_control message cce6c79 add odometer message to civic and odyssey 74cc834 fix PCM_SPEED factor 3f2baa5 fix honda dometer scaling f6fd6b9 fix comments and values f0ba5e2 whitespace consistency 8c77a5d dbc file preprocessor 10f8c6e consistent can message names for supported Hondas af07d6a Topyota Corolla: added dbc file, seems the same as Rav4 a632fde Cleanup duplicate message names git-subtree-dir: opendbc git-subtree-split: 3ca654f88545d05bf23cb8ff945f06a28c32902e
36 lines
1.2 KiB
Python
Executable File
36 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python2
|
|
import os
|
|
import re
|
|
|
|
cur_path = os.path.dirname(os.path.realpath(__file__))
|
|
generator_path = os.path.join(cur_path, '../')
|
|
|
|
for dir_name, _, _ in os.walk(cur_path):
|
|
if dir_name == cur_path:
|
|
continue
|
|
|
|
print dir_name
|
|
|
|
for filename in os.listdir(dir_name):
|
|
if filename.startswith('_'):
|
|
continue
|
|
|
|
print filename
|
|
dbc_file = open(os.path.join(dir_name, filename)).read()
|
|
include = re.search(r'CM_ "IMPORT (.*?)"', dbc_file)
|
|
if include is not None:
|
|
dbc_file = dbc_file.replace(include.group(0), '\nCM_ "%s starts here"' % filename)
|
|
include_path = os.path.join(dir_name, include.group(1))
|
|
|
|
# Load included file
|
|
include_file = open(include_path).read()
|
|
include_file = 'CM_ "Imported file %s starts here"\n' % include.group(1) + include_file
|
|
dbc_file = include_file + dbc_file
|
|
|
|
dbc_file = 'CM_ "AUTOGENERATED FILE, DO NOT EDIT"\n' + dbc_file
|
|
|
|
output_filename = filename.replace('.dbc', '_generated.dbc')
|
|
output_dbc_file = open(os.path.join(generator_path, output_filename), 'w')
|
|
output_dbc_file.write(dbc_file)
|
|
output_dbc_file.close()
|