summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-19 00:22:24 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-19 00:22:24 +0300
commite5cb8997a1033373426411d15f506413e54dcd59 (patch)
tree1f12a07f6ae298aae4ca086fd1bc29ff548dbb74 /src
parentaf5493fb146a99368b0cda65d406b65d5d96f91a (diff)
test: add script for testing esp32-cam
Diffstat (limited to 'src')
-rwxr-xr-xsrc/test/test_esp32_cam.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/test/test_esp32_cam.py b/src/test/test_esp32_cam.py
new file mode 100755
index 0000000..883b6f0
--- /dev/null
+++ b/src/test/test_esp32_cam.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+import sys
+import os.path
+sys.path.extend([
+ os.path.realpath(
+ os.path.join(os.path.dirname(os.path.join(__file__)), '..', '..')
+ )
+])
+
+from pprint import pprint
+from argparse import ArgumentParser
+from time import sleep
+from src.home.util import parse_addr
+from src.home.camera import esp32
+from src.home.config import config
+
+if __name__ == '__main__':
+ parser = ArgumentParser()
+ parser.add_argument('--addr', type=str, required=True,
+ help='camera server address, in host:port format')
+ parser.add_argument('--status', action='store_true',
+ help='print status and exit')
+
+ arg = config.load(False, parser=parser)
+ cam = esp32.WebClient(addr=parse_addr(arg.addr))
+
+ if arg.status:
+ status = cam.getstatus()
+ pprint(status)
+ sys.exit(0)
+
+ if cam.syncsettings(dict(
+ vflip=True,
+ hmirror=True,
+ framesize=esp32.FrameSize.SVGA_800x600,
+ lenc=True,
+ wpc=False,
+ bpc=False,
+ raw_gma=False,
+ agc=True,
+ gainceiling=5,
+ quality=10,
+ awb_gain=False,
+ awb=True,
+ aec_dsp=True,
+ aec=True
+ )) is True:
+ print('some settings were changed, sleeping for 0.5 sec')
+ sleep(0.5)
+
+ # cam.setdelay(200)
+
+ cam.setflash(True)
+ sleep(0.2)
+ cam.capture('/tmp/capture.jpg')
+ cam.setflash(False)