Skip to content

Commit b68957e

Browse files
committed
add pandadebug support
1 parent b5e4962 commit b68957e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")
2020

21+
DEBUG = os.getenv("PANDADEBUG") is not None
22+
2123
# *** wifi mode ***
2224

2325
def build_st(target, mkfile="Makefile"):
@@ -34,7 +36,10 @@ def parse_can_buffer(dat):
3436
address = f1 >> 3
3537
else:
3638
address = f1 >> 21
37-
ret.append((address, f2>>16, ddat[8:8+(f2&0xF)], (f2>>4)&0xFF))
39+
dddat = ddat[8:8+(f2&0xF)]
40+
if DEBUG:
41+
print(" R %x: %s" % (address, str(dddat).encode("hex")))
42+
ret.append((address, f2>>16, dddat, (f2>>4)&0xFF))
3843
return ret
3944

4045
class PandaWifiStreaming(object):
@@ -369,6 +374,8 @@ def can_send_many(self, arr):
369374
extended = 4
370375
for addr, _, dat, bus in arr:
371376
assert len(dat) <= 8
377+
if DEBUG:
378+
print(" W %x: %s" % (addr, dat.encode("hex")))
372379
if addr >= 0x800:
373380
rir = (addr << 3) | transmit | extended
374381
else:

0 commit comments

Comments
 (0)