-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TX message guaranteed delivery (#421)
* wait for tx slots before clearing nak * fix bootstub * Fixed misra * Cleanup * Added bulk write test to test USB NAK on bulk CAN messages * Added automated bulk tx test * Fixed linter * Fixed latency test influence * Added timeout to python API * Disabled can write timeout in bulk write test Co-authored-by: Robbe <[email protected]>
- Loading branch information
1 parent
d8f6184
commit da8e00f
Showing
8 changed files
with
143 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
import time | ||
import threading | ||
|
||
from panda import Panda | ||
|
||
# The TX buffers on pandas is 0x100 in length. | ||
NUM_MESSAGES_PER_BUS = 10000 | ||
|
||
def flood_tx(panda): | ||
print('Sending!') | ||
msg = b"\xaa"*4 | ||
packet = [[0xaa, None, msg, 0], [0xaa, None, msg, 1], [0xaa, None, msg, 2]] * NUM_MESSAGES_PER_BUS | ||
panda.can_send_many(packet) | ||
print(f"Done sending {3*NUM_MESSAGES_PER_BUS} messages!") | ||
|
||
if __name__ == "__main__": | ||
serials = Panda.list() | ||
if len(serials) != 2: | ||
raise Exception("Connect two pandas to perform this test!") | ||
|
||
sender = Panda(serials[0]) | ||
receiver = Panda(serials[1]) | ||
|
||
sender.set_safety_mode(Panda.SAFETY_ALLOUTPUT) | ||
receiver.set_safety_mode(Panda.SAFETY_ALLOUTPUT) | ||
|
||
# Start transmisson | ||
threading.Thread(target=flood_tx, args=(sender,)).start() | ||
|
||
# Receive as much as we can in a few second time period | ||
rx = [] | ||
old_len = 0 | ||
start_time = time.time() | ||
while time.time() - start_time < 2 or len(rx) > old_len: | ||
old_len = len(rx) | ||
rx.extend(receiver.can_recv()) | ||
print(f"Received {len(rx)} messages") |