mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-17 04:12:05 +08:00
26 lines
574 B
Python
26 lines
574 B
Python
import os
|
|
from openpilot.common.hardware.hw import Paths
|
|
|
|
|
|
CAMERA_FPS = 20
|
|
SEGMENT_LENGTH = 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
|