Skip to content

Commit

Permalink
example script to flash hyundai blinkers on B-CAN
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjhogan committed Oct 16, 2023
1 parent 28bd4dd commit 82f2f34
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions examples/hyundai_flash_all_blinkers.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 82f2f34

Please sign in to comment.