Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

I added the wrapper to camera_overlord.[py #59

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions client/drivers/camera_overlord.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@
import os
import time

picam2 = Picamera2()
picam2.start()
picam2.options['quality'] = 80
if __name__ == '__main__':
picam2 = Picamera2()
picam2.start()
picam2.options['quality'] = 80

try:
f = open('/tmp/snapshot.jpg','x')
f.close()
except:
print('Snapshot already exists')

try:
while True:
picam2.capture_file("/tmp/snapshot2.jpg")
os.replace("/tmp/snapshot2.jpg", "/tmp/snapshot.jpg")
time.sleep(0.5)
try:
f = open('/tmp/snapshot.jpg','x')
f.close()
except:
print('Snapshot already exists')
try:
while True:
picam2.capture_file("/tmp/snapshot2.jpg")
os.replace("/tmp/snapshot2.jpg", "/tmp/snapshot.jpg")
time.sleep(0.5)

except KeyboardInterrupt:
picam2.close()
print('Closed nicely')
quit()
except KeyboardInterrupt:
picam2.close()
print('Closed nicely')
quit()