Dies und das
This commit is contained in:
@@ -23,9 +23,7 @@ DRIVE_ESTIMATOR_CALIBRATION_FILE = os.path.join(
|
||||
ROUTE_LIBRARY_FILE = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'config', 'route_library.json'
|
||||
)
|
||||
CAMERA_SETTINGS_FILE = os.path.join(
|
||||
os.path.dirname(__file__), '..', 'config', 'camera_settings.json'
|
||||
)
|
||||
CAMERA_RUNTIME_SETTINGS_FILE = '/tmp/exomy_camera_settings.json'
|
||||
MOTOR_TEST_LOCK = threading.Lock()
|
||||
GPS_PORT_PATTERNS = [
|
||||
'/dev/serial/by-id/*',
|
||||
@@ -379,7 +377,7 @@ def normalize_camera_fps(value):
|
||||
def read_camera_settings():
|
||||
default_profile = get_default_camera_profile()
|
||||
try:
|
||||
with open(CAMERA_SETTINGS_FILE, 'r', encoding='utf-8') as handle:
|
||||
with open(CAMERA_RUNTIME_SETTINGS_FILE, 'r', encoding='utf-8') as handle:
|
||||
payload = json.load(handle)
|
||||
except (FileNotFoundError, json.JSONDecodeError, OSError, ValueError, TypeError):
|
||||
return default_profile
|
||||
@@ -410,7 +408,6 @@ def read_camera_settings():
|
||||
def write_camera_settings(profile, fps):
|
||||
profile = dict(profile)
|
||||
fps = normalize_camera_fps(fps)
|
||||
os.makedirs(os.path.dirname(CAMERA_SETTINGS_FILE), exist_ok=True)
|
||||
payload = {
|
||||
'profile': profile['id'],
|
||||
'width': profile['width'],
|
||||
@@ -418,14 +415,14 @@ def write_camera_settings(profile, fps):
|
||||
'fps': fps,
|
||||
'updated_at': int(time.time()),
|
||||
}
|
||||
with open(CAMERA_SETTINGS_FILE, 'w', encoding='utf-8') as handle:
|
||||
with open(CAMERA_RUNTIME_SETTINGS_FILE, 'w', encoding='utf-8') as handle:
|
||||
json.dump(payload, handle, indent=2, sort_keys=True)
|
||||
handle.write('\n')
|
||||
|
||||
|
||||
def read_camera_settings_version():
|
||||
try:
|
||||
with open(CAMERA_SETTINGS_FILE, 'r', encoding='utf-8') as handle:
|
||||
with open(CAMERA_RUNTIME_SETTINGS_FILE, 'r', encoding='utf-8') as handle:
|
||||
payload = json.load(handle)
|
||||
except (FileNotFoundError, json.JSONDecodeError, OSError, ValueError, TypeError):
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user