mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 13:32:04 +08:00
dd778596b7
date: 2025-03-15T21:10:51 master commit: fb7b9c0f9420d228f03362970ebcfb7237095cf3
30 lines
662 B
Python
30 lines
662 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: float) -> float:
|
|
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: int) -> int:
|
|
try:
|
|
statvfs = os.statvfs(Paths.log_root())
|
|
available_bytes = statvfs.f_bavail * statvfs.f_frsize
|
|
except OSError:
|
|
available_bytes = default
|
|
|
|
return available_bytes
|