Dies und das

This commit is contained in:
2026-05-25 17:26:56 +02:00
parent 023017d1fb
commit 11d1a16281
4 changed files with 10 additions and 13 deletions
+2 -2
View File
@@ -1209,8 +1209,8 @@ function updateCameraFrameLayout() {
var portHeight = port.clientHeight;
if (!portWidth || !portHeight) return;
var videoWidth = (video && video.naturalWidth) || 1280;
var videoHeight = (video && video.naturalHeight) || 720;
var videoWidth = (video && video.naturalWidth) || 1296;
var videoHeight = (video && video.naturalHeight) || 972;
var aspectRatio = videoWidth / videoHeight;
var frameWidth = portWidth;
@@ -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
@@ -13,7 +13,7 @@ LATEST_JPEG = None
LATEST_LOCK = threading.Lock()
PORT = 8081
CONFIG_FILE = os.path.join(os.path.dirname(__file__), '..', 'config', 'camera_settings.json')
RUNTIME_CONFIG_FILE = '/tmp/exomy_camera_settings.json'
DEFAULT_CAMERA_SETTINGS = {
'width': 1296,
'height': 972,
@@ -24,7 +24,7 @@ DEFAULT_CAMERA_SETTINGS = {
def load_camera_settings():
settings = dict(DEFAULT_CAMERA_SETTINGS)
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as handle:
with open(RUNTIME_CONFIG_FILE, 'r', encoding='utf-8') as handle:
raw_settings = json.load(handle)
except (FileNotFoundError, json.JSONDecodeError, OSError, ValueError, TypeError):
return settings
+2 -2
View File
@@ -1209,8 +1209,8 @@ function updateCameraFrameLayout() {
var portHeight = port.clientHeight;
if (!portWidth || !portHeight) return;
var videoWidth = (video && video.naturalWidth) || 1280;
var videoHeight = (video && video.naturalHeight) || 720;
var videoWidth = (video && video.naturalWidth) || 1296;
var videoHeight = (video && video.naturalHeight) || 972;
var aspectRatio = videoWidth / videoHeight;
var frameWidth = portWidth;