From 4cf2dbf1b8e22fda577a749b8d94ecb855d35f91 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Mon, 1 Dec 2025 12:39:13 +0100 Subject: [PATCH] Camera app: don't repeat yourself --- .../apps/com.micropythonos.camera/assets/camera_app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py b/internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py index 12f4d497..054016d3 100644 --- a/internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py +++ b/internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py @@ -260,12 +260,13 @@ class CameraApp(Activity): print("Taking picture...") # Would be nice to check that there's enough free space here, and show an error if not... import os + path = "data/images" try: os.mkdir("data") except OSError: pass try: - os.mkdir("data/images") + os.mkdir(path) except OSError: pass if self.current_cam_buffer is None: @@ -281,7 +282,7 @@ class CameraApp(Activity): self.status_label_cont.remove_flag(lv.obj.FLAG.HIDDEN) return colorname = "RGB565" if self.colormode else "GRAY" - filename=f"data/images/camera_capture_{mpos.time.epoch_seconds()}_{self.width}x{self.height}_{colorname}.raw" + filename=f"{path}/picture_{mpos.time.epoch_seconds()}_{self.width}x{self.height}_{colorname}.raw" try: with open(filename, 'wb') as f: f.write(self.current_cam_buffer) # This takes around 17 seconds to store 921600 bytes, so ~50KB/s, so would be nice to show some progress bar