mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
Merge branch 'upstream/panda/master' into sync-20250809
This commit is contained in:
@@ -114,6 +114,8 @@ class Panda:
|
||||
|
||||
# from https://github.com/commaai/openpilot/blob/103b4df18cbc38f4129555ab8b15824d1a672bdf/cereal/log.capnp#L648
|
||||
HW_TYPE_UNKNOWN = b'\x00'
|
||||
HW_TYPE_WHITE = b'\x01'
|
||||
HW_TYPE_BLACK = b'\x03'
|
||||
HW_TYPE_DOS = b'\x06'
|
||||
HW_TYPE_RED_PANDA = b'\x07'
|
||||
HW_TYPE_TRES = b'\x09'
|
||||
@@ -125,10 +127,11 @@ class Panda:
|
||||
HEALTH_STRUCT = struct.Struct("<IIIIIIIIBBBBBHBBBHfBBHBHHB")
|
||||
CAN_HEALTH_STRUCT = struct.Struct("<BIBBBBBBBBIIIIIIIHHBBBIIII")
|
||||
|
||||
F4_DEVICES = [HW_TYPE_DOS, ]
|
||||
F4_DEVICES = [HW_TYPE_WHITE, HW_TYPE_BLACK, HW_TYPE_DOS, ]
|
||||
H7_DEVICES = [HW_TYPE_RED_PANDA, HW_TYPE_TRES, HW_TYPE_CUATRO]
|
||||
|
||||
INTERNAL_DEVICES = (HW_TYPE_DOS, HW_TYPE_TRES, HW_TYPE_CUATRO)
|
||||
DEPRECATED_DEVICES = (HW_TYPE_WHITE, HW_TYPE_BLACK)
|
||||
|
||||
MAX_FAN_RPMs = {
|
||||
HW_TYPE_DOS: 6500,
|
||||
@@ -231,6 +234,10 @@ class Panda:
|
||||
self.health_version, self.can_version, self.can_health_version = self.get_packets_versions()
|
||||
logger.debug("connected")
|
||||
|
||||
hw_type = self.get_type()
|
||||
if hw_type in Panda.DEPRECATED_DEVICES:
|
||||
print("WARNING: Using deprecated HW")
|
||||
|
||||
# disable openpilot's heartbeat checks
|
||||
if self._disable_checks:
|
||||
self.set_heartbeat_disabled()
|
||||
@@ -345,9 +352,10 @@ class Panda:
|
||||
return isinstance(self._handle, PandaUsbHandle)
|
||||
|
||||
@classmethod
|
||||
def list(cls):
|
||||
def list(cls, usb_only: bool = False):
|
||||
ret = cls.usb_list()
|
||||
ret += cls.spi_list()
|
||||
if not usb_only:
|
||||
ret += cls.spi_list()
|
||||
return list(set(ret))
|
||||
|
||||
@classmethod
|
||||
@@ -460,6 +468,10 @@ class Panda:
|
||||
logger.info("flash: already up to date")
|
||||
return
|
||||
|
||||
hw_type = self.get_type()
|
||||
if hw_type in Panda.DEPRECATED_DEVICES:
|
||||
raise RuntimeError(f"HW type {hw_type.hex()} is deprecated and can no longer be flashed.")
|
||||
|
||||
if not fn:
|
||||
fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn)
|
||||
assert os.path.isfile(fn)
|
||||
|
||||
Reference in New Issue
Block a user