Files
panda-meb/scripts/echo.py

18 lines
585 B
Python
Raw Normal View History

2019-11-07 17:45:16 -08:00
#!/usr/bin/env python3
from opendbc.car.structs import CarParams
2023-08-14 12:52:02 -07:00
from panda import Panda
2019-11-07 17:45:16 -08:00
# This script is intended to be used in conjunction with the echo_loopback_test.py test script from panda jungle.
# It sends a reversed response back for every message received containing b"test".
if __name__ == "__main__":
p = Panda()
p.set_safety_mode(CarParams.SafetyModel.allOutput)
2019-11-25 13:09:58 -08:00
p.set_power_save(False)
2019-11-07 17:45:16 -08:00
while True:
incoming = p.can_recv()
for message in incoming:
address, data, bus = message
2019-11-07 17:45:16 -08:00
if b'test' in data:
p.can_send(address, data[::-1], bus)