From 25d2555e4957a259da65ba004278bc559a43d701 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 30 Oct 2024 17:04:05 -0700 Subject: [PATCH] tizi: fix panda amp race condition (#33895) * backoff * bump panda * cleanup * fix mypy --------- Co-authored-by: Comma Device --- panda | 2 +- system/hardware/tici/amplifier.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/panda b/panda index 352e7ff138..0b364ece1e 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 352e7ff138e9706715c8f0b76a985751ac620ae3 +Subproject commit 0b364ece1eafa2e66b71be7cade3fdfb56a3014e diff --git a/system/hardware/tici/amplifier.py b/system/hardware/tici/amplifier.py index af82067467..f6b29ec0ce 100755 --- a/system/hardware/tici/amplifier.py +++ b/system/hardware/tici/amplifier.py @@ -125,13 +125,15 @@ class Amplifier: def set_configs(self, configs: list[AmpConfig]) -> bool: # retry in case panda is using the amp tries = 15 - for i in range(15): + backoff = 0. + for i in range(tries): try: self._set_configs(configs) return True except OSError: + backoff += 0.1 + time.sleep(backoff) print(f"Failed to set amp config, {tries - i - 1} retries left") - time.sleep(0.02) return False def set_global_shutdown(self, amp_disabled: bool) -> bool: