Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Dec 3, 2019
1 parent a5c640a commit 25d8800
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
can/*.so
can/build/
can/obj/
can/packer_impl.cpp
can/packer_pyx.cpp
can/parser_pyx.cpp
7 changes: 3 additions & 4 deletions can/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ for x in os.listdir('../'):
libdbc = env.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]+dbcs, LIBS=["capnp", "kj"])

# packer
env.Command(['packer_impl.so'],
['packer_impl.pyx', 'packer_setup.py'],
"cd opendbc/can && python3 packer_setup.py build_ext --inplace")
env.Command(['packer_pyx.so'],
['packer_pyx.pyx', 'packer_pyx_setup.py'],
"cd opendbc/can && python3 packer_pyx_setup.py build_ext --inplace")

# parser
env.Command(['parser_pyx.so'],
[libdbc, cereal, 'parser_pyx_setup.py', 'parser_pyx.pyx', 'common.pxd'],
"cd opendbc/can && python3 parser_pyx_setup.py build_ext --inplace")

2 changes: 1 addition & 1 deletion can/packer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# pylint: skip-file
from opendbc.can.packer_impl import CANPacker
from opendbc.can.packer_pyx import CANPacker
assert CANPacker
File renamed without changes.
2 changes: 1 addition & 1 deletion can/packer_setup.py → can/packer_pyx_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

setup(name='CAN Packer API Implementation',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
ext_modules=cythonize(Extension("packer_impl", ["packer_impl.pyx"], language="c++", extra_compile_args=["-std=c++11"])))
ext_modules=cythonize(Extension("packer_pyx", ["packer_pyx.pyx"], language="c++", extra_compile_args=["-std=c++11"])))
22 changes: 21 additions & 1 deletion can/tests/test_packer_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@

from opendbc.can.parser import CANParser
from opendbc.can.packer import CANPacker
from opendbc.boardd.boardd import can_list_to_can_capnp
import cereal.messaging as messaging


# Python implementation so we don't have to depend on boardd
def can_list_to_can_capnp(can_msgs, msgtype='can'):
dat = messaging.new_message()
dat.init(msgtype, len(can_msgs))

for i, can_msg in enumerate(can_msgs):
if msgtype == 'sendcan':
cc = dat.sendcan[i]
else:
cc = dat.can[i]

cc.address = can_msg[0]
cc.busTime = can_msg[1]
cc.dat = bytes(can_msg[2])
cc.src = can_msg[3]

return dat.to_bytes()


class TestCanParserPacker(unittest.TestCase):
def test_civic(self):
Expand Down

0 comments on commit 25d8800

Please sign in to comment.