mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 19:33:49 +08:00
Squashed 'panda/' changes from c371fe6..2573d86
2573d86 docs say max is 4, respect the docs
864cd8f failing on some devices
54bcc67 Merge pull request #75 from gregjhogan/j2534-vs-2017-upgrade
1664270 Merge pull request #74 from gregjhogan/j2534-disconnect-fix
a7e3a8f bump panda version for serial bug
aa0cfad fix UART hang
09ab8f6 add sendaddr support to isotp
40a1883 fix up baud rate
65997ff add PandaSerial and location panda (aka pigeon) test
57d633c upgraded to VS 2017
35cc32a fixed pointer exception on disconnect
git-subtree-dir: panda
git-subtree-split: 2573d861e605a2dcf456a6421b31e83fdd9ca606
old-commit-hash: 5f014635e1
This commit is contained in:
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
|
||||
from panda import Panda, PandaSerial
|
||||
|
||||
def add_nmea_checksum(msg):
|
||||
d = msg[1:]
|
||||
cs = 0
|
||||
for i in d:
|
||||
cs ^= ord(i)
|
||||
return msg + "*%02X" % cs
|
||||
|
||||
if __name__ == "__main__":
|
||||
panda = Panda()
|
||||
ser = PandaSerial(panda, 1, 9600)
|
||||
|
||||
# power cycle by toggling reset
|
||||
print "resetting"
|
||||
panda.set_esp_power(0)
|
||||
time.sleep(0.5)
|
||||
panda.set_esp_power(1)
|
||||
time.sleep(0.5)
|
||||
print "done"
|
||||
print ser.read(1024)
|
||||
|
||||
# upping baud rate
|
||||
# 460800 has issues
|
||||
baudrate = 460800
|
||||
|
||||
print "upping baud rate"
|
||||
msg = add_nmea_checksum("$PUBX,41,1,0007,0003,%d,0" % baudrate)+"\r\n"
|
||||
print msg
|
||||
ser.write(msg)
|
||||
time.sleep(0.1) # needs a wait for it to actually send
|
||||
|
||||
# new panda serial
|
||||
ser = PandaSerial(panda, 1, baudrate)
|
||||
|
||||
while True:
|
||||
ret = ser.read(1024)
|
||||
if len(ret) > 0:
|
||||
sys.stdout.write(ret)
|
||||
sys.stdout.flush()
|
||||
#print str(ret).encode("hex")
|
||||
|
||||
Reference in New Issue
Block a user