Added toggles to customize the lane lines, path, road edges, path edges, show the acceleration/deceleration on the path, lead info, driving logics, adjacent lanes, blind spot path, fps tracker, and an "Unlimited Length" mode that extends the road UI out as far as the model can see.
41 lines
952 B
Python
41 lines
952 B
Python
import os
|
|
from openpilot.system.hardware.hw import Paths
|
|
|
|
|
|
CAMERA_FPS = 20
|
|
SEGMENT_LENGTH = 60
|
|
|
|
STATS_DIR_FILE_LIMIT = 10000
|
|
STATS_SOCKET = "ipc:///tmp/stats"
|
|
STATS_FLUSH_TIME_S = 60
|
|
|
|
def get_available_percent(default=None):
|
|
try:
|
|
statvfs = os.statvfs(Paths.log_root())
|
|
available_percent = 100.0 * statvfs.f_bavail / statvfs.f_blocks
|
|
except OSError:
|
|
available_percent = default
|
|
|
|
return available_percent
|
|
|
|
|
|
def get_available_bytes(default=None):
|
|
try:
|
|
statvfs = os.statvfs(Paths.log_root())
|
|
available_bytes = statvfs.f_bavail * statvfs.f_frsize
|
|
except OSError:
|
|
available_bytes = default
|
|
|
|
return available_bytes
|
|
|
|
def get_used_bytes(default=None):
|
|
try:
|
|
statvfs = os.statvfs(Paths.log_root())
|
|
total_bytes = statvfs.f_blocks * statvfs.f_frsize
|
|
available_bytes = statvfs.f_bavail * statvfs.f_frsize
|
|
used_bytes = total_bytes - available_bytes
|
|
except OSError:
|
|
used_bytes = default
|
|
|
|
return used_bytes
|