From 82f2f34ca591d834897cc05c7d7fcf31eda6f350 Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Mon, 16 Oct 2023 02:24:11 -0700 Subject: [PATCH] example script to flash hyundai blinkers on B-CAN --- examples/hyundai_flash_all_blinkers.py | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 examples/hyundai_flash_all_blinkers.py diff --git a/examples/hyundai_flash_all_blinkers.py b/examples/hyundai_flash_all_blinkers.py new file mode 100755 index 0000000000..5e687df263 --- /dev/null +++ b/examples/hyundai_flash_all_blinkers.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import time +from panda import Panda + +p = Panda() +p.set_safety_mode(Panda.SAFETY_ALLOUTPUT) + +# send on B-CAN +ADDR = 0x89 + +# flash blinkers (blinks until door is opened) +# 0.00 0 0x89 0003000000000000 +# 0.03 0 0x89 0001000000000000 +# 0.04 0 0x89 0001000000000000 +# 0.04 0 0x89 0001000000000000 +# 0.89 0 0x89 1001000000000000 +# 0.04 0 0x89 1001000000000000 +# 0.04 0 0x89 1001000000000000 +# 0.42 0 0x89 0001000000000000 +# 0.03 0 0x89 0001000000000000 +# 0.04 0 0x89 0001000000000000 +p.can_send(ADDR, b'\x00\x03\x00\x00\x00\x00\x00\x00', 0, 0) +for _ in range(3): + time.sleep(0.03) + p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0) +time.sleep(0.85) +for _ in range(3): + time.sleep(0.03) + p.can_send(ADDR, b'\x10\x01\x00\x00\x00\x00\x00\x00', 0, 0) +time.sleep(0.35) +for _ in range(3): + time.sleep(0.03) + p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0) + +# # unlock doors (two blinks, doesn't unlock when sent on B-CAN) +# # 0.00 0 0x89 0003000000000000 +# # 0.03 0 0x89 0001000000000000 +# # 0.04 0 0x89 0001000000000000 +# # 0.03 0 0x89 0001000000000000 +# # 0.89 0 0x89 4001000000000000 +# # 0.04 0 0x89 4001000000000000 +# # 0.04 0 0x89 4001000000000000 +# # 0.41 0 0x89 0001000000000000 +# # 0.04 0 0x89 0001000000000000 +# # 0.04 0 0x89 0001000000000000 +# p.can_send(ADDR, b'\x00\x03\x00\x00\x00\x00\x00\x00', 0, 0) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0) +# time.sleep(0.85) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x40\x01\x00\x00\x00\x00\x00\x00', 0, 0) +# time.sleep(0.35) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0) + +# # lock doors (one blink, doesn't lock when sent on B-CAN) +# # 0.00 0 0x89 0003000000000000 +# # 0.03 0 0x89 0001000000000000 +# # 0.03 0 0x89 0001000000000000 +# # 0.04 0 0x89 0001000000000000 +# # 0.89 0 0x89 8001000000000000 +# # 0.04 0 0x89 8001000000000000 +# # 0.03 0 0x89 8001000000000000 +# # 0.44 0 0x89 0001000000000000 +# # 0.04 0 0x89 0001000000000000 +# # 0.03 0 0x89 0001000000000000 +# p.can_send(ADDR, b'\x00\x03\x00\x00\x00\x00\x00\x00', 0, 0) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0) +# time.sleep(0.85) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x80\x01\x00\x00\x00\x00\x00\x00', 0, 0) +# time.sleep(0.35) +# for _ in range(3): +# time.sleep(0.03) +# p.can_send(ADDR, b'\x00\x01\x00\x00\x00\x00\x00\x00', 0, 0)