mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
allow disabling heartbeat while in non-car safety mode (#1035)
* allow disabling heartbeat while in non-car safety mode * simple test * clean that up * remove that
This commit is contained in:
@@ -209,7 +209,7 @@ class Panda:
|
||||
|
||||
FLAG_GM_HW_CAM = 1
|
||||
|
||||
def __init__(self, serial: Optional[str] = None, claim: bool = True):
|
||||
def __init__(self, serial: Optional[str] = None, claim: bool = True, disable_checks: bool = True):
|
||||
self._serial = serial
|
||||
self._handle = None
|
||||
self._bcd_device = None
|
||||
@@ -217,6 +217,11 @@ class Panda:
|
||||
# connect and set mcu type
|
||||
self.connect(claim)
|
||||
|
||||
# disable openpilot's heartbeat checks
|
||||
if disable_checks:
|
||||
self.set_heartbeat_disabled()
|
||||
self.set_power_save(0)
|
||||
|
||||
def close(self):
|
||||
self._handle.close()
|
||||
self._handle = None
|
||||
@@ -552,11 +557,8 @@ class Panda:
|
||||
self._handle.controlWrite(Panda.REQUEST_OUT, 0xda, int(bootmode), 0, b'')
|
||||
time.sleep(0.2)
|
||||
|
||||
def set_safety_mode(self, mode=SAFETY_SILENT, param=0, disable_checks=True):
|
||||
def set_safety_mode(self, mode=SAFETY_SILENT, param=0):
|
||||
self._handle.controlWrite(Panda.REQUEST_OUT, 0xdc, mode, param, b'')
|
||||
if disable_checks:
|
||||
self.set_heartbeat_disabled()
|
||||
self.set_power_save(0)
|
||||
|
||||
def set_gmlan(self, bus=2):
|
||||
# TODO: check panda type
|
||||
|
||||
Reference in New Issue
Block a user