mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-25 22:13:53 +08:00
dragonpilot beta3
date: 2023-11-20T10:53:27 commit: 7521cefd30dbe703c281db9056f6c6e5f8a05de8
This commit is contained in:
@@ -493,6 +493,10 @@ class Panda:
|
||||
pass
|
||||
|
||||
def flash(self, fn=None, code=None, reconnect=True):
|
||||
if self.up_to_date(fn=fn):
|
||||
logging.debug("flash: already up to date")
|
||||
return
|
||||
|
||||
if not fn:
|
||||
fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn)
|
||||
assert os.path.isfile(fn)
|
||||
@@ -557,9 +561,10 @@ class Panda:
|
||||
serials = Panda.list()
|
||||
return True
|
||||
|
||||
def up_to_date(self) -> bool:
|
||||
def up_to_date(self, fn=None) -> bool:
|
||||
current = self.get_signature()
|
||||
fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn)
|
||||
if fn is None:
|
||||
fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn)
|
||||
expected = Panda.get_signature_from_firmware(fn)
|
||||
return (current == expected)
|
||||
|
||||
@@ -987,3 +992,7 @@ class Panda:
|
||||
|
||||
def force_relay_drive(self, intercept_relay_drive, ignition_relay_drive):
|
||||
self._handle.controlWrite(Panda.REQUEST_OUT, 0xc5, (int(intercept_relay_drive) | int(ignition_relay_drive) << 1), 0, b'')
|
||||
|
||||
def read_som_gpio(self) -> bool:
|
||||
r = self._handle.controlRead(Panda.REQUEST_IN, 0xc6, 0, 0, 1)
|
||||
return r[0] == 1
|
||||
|
||||
Reference in New Issue
Block a user