some legitimate blunders

pull/35744/head
Shane Smiskol 2 months ago
parent 19dc88fb3c
commit 58bdd180e0
  1. 8
      selfdrive/debug/car/fw_versions.py
  2. 2
      selfdrive/ui/layouts/home.py
  3. 4
      selfdrive/ui/onroad/exp_button.py
  4. 2
      selfdrive/ui/widgets/pairing_dialog.py

@ -47,15 +47,15 @@ if __name__ == "__main__":
num_pandas = len(messaging.recv_one_retry(pandaStates_sock).pandaStates) num_pandas = len(messaging.recv_one_retry(pandaStates_sock).pandaStates)
t = time.time() t = time.monotonic()
print("Getting vin...") print("Getting vin...")
set_obd_multiplexing(True) set_obd_multiplexing(True)
vin_rx_addr, vin_rx_bus, vin = get_vin(*can_callbacks, (0, 1)) vin_rx_addr, vin_rx_bus, vin = get_vin(*can_callbacks, (0, 1))
print(f'RX: {hex(vin_rx_addr)}, BUS: {vin_rx_bus}, VIN: {vin}') print(f'RX: {hex(vin_rx_addr)}, BUS: {vin_rx_bus}, VIN: {vin}')
print(f"Getting VIN took {time.time() - t:.3f} s") print(f"Getting VIN took {time.monotonic() - t:.3f} s")
print() print()
t = time.time() t = time.monotonic()
fw_vers = get_fw_versions(*can_callbacks, set_obd_multiplexing, query_brand=args.brand, extra=extra, num_pandas=num_pandas, progress=True) fw_vers = get_fw_versions(*can_callbacks, set_obd_multiplexing, query_brand=args.brand, extra=extra, num_pandas=num_pandas, progress=True)
_, candidates = match_fw_to_car(fw_vers, vin) _, candidates = match_fw_to_car(fw_vers, vin)
@ -71,4 +71,4 @@ if __name__ == "__main__":
print() print()
print("Possible matches:", candidates) print("Possible matches:", candidates)
print(f"Getting fw took {time.time() - t:.3f} s") print(f"Getting fw took {time.monotonic() - t:.3f} s")

@ -67,7 +67,7 @@ class HomeLayout(Widget):
self.current_state = state self.current_state = state
def _render(self, rect: rl.Rectangle): def _render(self, rect: rl.Rectangle):
current_time = time.time() current_time = time.monotonic()
if current_time - self.last_refresh >= REFRESH_INTERVAL: if current_time - self.last_refresh >= REFRESH_INTERVAL:
self._refresh() self._refresh()
self.last_refresh = current_time self.last_refresh = current_time

@ -41,7 +41,7 @@ class ExpButton(Widget):
# Hold new state temporarily # Hold new state temporarily
self._held_mode = new_mode self._held_mode = new_mode
self._hold_end_time = time.time() + self._hold_duration self._hold_end_time = time.monotonic() + self._hold_duration
return True return True
return False return False
@ -58,7 +58,7 @@ class ExpButton(Widget):
rl.draw_texture(texture, center_x - texture.width // 2, center_y - texture.height // 2, self._white_color) rl.draw_texture(texture, center_x - texture.width // 2, center_y - texture.height // 2, self._white_color)
def _held_or_actual_mode(self): def _held_or_actual_mode(self):
now = time.time() now = time.monotonic()
if self._hold_end_time and now < self._hold_end_time: if self._hold_end_time and now < self._hold_end_time:
return self._held_mode return self._held_mode

@ -55,7 +55,7 @@ class PairingDialog:
self.qr_texture = None self.qr_texture = None
def _check_qr_refresh(self) -> None: def _check_qr_refresh(self) -> None:
current_time = time.time() current_time = time.monotonic()
if current_time - self.last_qr_generation >= self.QR_REFRESH_INTERVAL: if current_time - self.last_qr_generation >= self.QR_REFRESH_INTERVAL:
self._generate_qr_code() self._generate_qr_code()
self.last_qr_generation = current_time self.last_qr_generation = current_time

Loading…
Cancel
Save