File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
internal_filesystem/apps/com.micropythonos.camera/assets Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 44- Fri3d Camp 2024 Badge: improve battery monitor calibration to fix 0.1V delta
55- About app: add free, used and total storage space info
66- AppStore app: remove unnecessary scrollbar over publisher's name
7+ - Camera app: massive overhaul!
8+ - Lots of settings (basic, advanced, expert)
9+ - Enable high density QR code scanning from mobile phone screens
10+ - ImageView app: add delete functionality
711- OSUpdate app: pause download when wifi is lost, resume when reconnected
812- Settings app: fix un-checking of radio button
913- ImageView app: add support for grayscale images
Original file line number Diff line number Diff line change @@ -271,12 +271,24 @@ def snap_button_click(self, e):
271271 if self .current_cam_buffer is None :
272272 print ("snap_button_click: won't save empty image" )
273273 return
274+ # Check enough free space?
275+ stat = os .statvfs ("data/images" )
276+ free_space = stat [0 ] * stat [3 ]
277+ size_needed = len (self .current_cam_buffer )
278+ print (f"Free space { free_space } and size needed { size_needed } " )
279+ if free_space < size_needed :
280+ self .status_label .set_text (f"Free storage space is { free_space } , need { size_needed } , not saving..." )
281+ self .status_label_cont .remove_flag (lv .obj .FLAG .HIDDEN )
282+ return
274283 colorname = "RGB565" if self .colormode else "GRAY"
275284 filename = f"data/images/camera_capture_{ mpos .time .epoch_seconds ()} _{ self .width } x{ self .height } _{ colorname } .raw"
276285 try :
277286 with open (filename , 'wb' ) as f :
278287 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
279- print (f"Successfully wrote image to { filename } " )
288+ report = f"Successfully wrote image to { filename } "
289+ print (report )
290+ self .status_label .set_text (report )
291+ self .status_label_cont .remove_flag (lv .obj .FLAG .HIDDEN )
280292 except OSError as e :
281293 print (f"Error writing to file: { e } " )
282294
You can’t perform that action at this time.
0 commit comments