Skip to content

Commit 36b3171

Browse files
authored
cleanup heartbeat threads from scripts and test_canfd (commaai#1036)
* clean * remove disable
1 parent 7e843b3 commit 36b3171

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

tests/canfd/test_canfd.py

-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
import time
44
import random
5-
import _thread
65
from collections import defaultdict
76
from panda import Panda
87
from panda_jungle import PandaJungle # pylint: disable=import-error
@@ -18,19 +17,9 @@
1817

1918
_panda_serials = []
2019

21-
def start_heartbeat_thread(p):
22-
def heartbeat_thread(p):
23-
while True:
24-
try:
25-
p.send_heartbeat()
26-
time.sleep(.5)
27-
except Exception:
28-
break
29-
_thread.start_new_thread(heartbeat_thread, (p,))
3020

3121
def panda_init(serial, enable_canfd=False):
3222
p = Panda(serial=serial)
33-
start_heartbeat_thread(p)
3423
p.set_power_save(False)
3524
for bus in range(3):
3625
if enable_canfd:

tests/echo.py

-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
#!/usr/bin/env python3
22
import os
33
import sys
4-
import time
5-
import _thread
64

75
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
86
from panda import Panda # noqa: E402
97

108
# This script is intended to be used in conjunction with the echo_loopback_test.py test script from panda jungle.
119
# It sends a reversed response back for every message received containing b"test".
12-
13-
def heartbeat_thread(p):
14-
while True:
15-
try:
16-
p.send_heartbeat()
17-
time.sleep(0.5)
18-
except Exception:
19-
continue
20-
21-
# Resend every CAN message that has been received on the same bus, but with the data reversed
2210
if __name__ == "__main__":
2311
p = Panda()
24-
_thread.start_new_thread(heartbeat_thread, (p,))
2512
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)
2613
p.set_power_save(False)
2714

0 commit comments

Comments
 (0)