build(boards): micropython板卡执行 npm run build:prod
This commit is contained in:
@@ -7,14 +7,16 @@ MicroPython library for the GC032A(Inherit C module)
|
||||
"""
|
||||
|
||||
import time
|
||||
import base64
|
||||
from sensor import *
|
||||
from machine import SoftI2C, Pin
|
||||
from mixgo_sant import onboard_bot
|
||||
from esp_usb import CAM
|
||||
|
||||
class GC032A(Camera):
|
||||
def __init__(self, framesize=LCD, hmirror=None):
|
||||
def __init__(self, framesize=LCD, hmirror=None, frame=1):
|
||||
onboard_bot.cam_en(1, 500)
|
||||
super().__init__()
|
||||
super().__init__(frame)
|
||||
super().set_framesize(framesize)
|
||||
time.sleep_ms(100)
|
||||
if hmirror is not None:
|
||||
@@ -32,3 +34,36 @@ class GC032A(Camera):
|
||||
super().display()
|
||||
else:
|
||||
super().display_stop()
|
||||
|
||||
def snapshot(self, path=None, formats=0, quality=50):
|
||||
if path is None:
|
||||
_data = super().snapshot(formats=formats, quality=quality)
|
||||
if formats >= 2:
|
||||
return b'data:image/jpg;base64,' + base64.b64encode(_data)
|
||||
else:
|
||||
return _data
|
||||
else:
|
||||
return super().snapshot(path, quality=50)
|
||||
|
||||
class UVC(CAM):
|
||||
def __init__(self, framesize=QVGA):
|
||||
super().__init__(framesize)
|
||||
|
||||
def deinit(self):
|
||||
super().deinit()
|
||||
|
||||
def display(self, show=True):
|
||||
if show:
|
||||
super().display()
|
||||
else:
|
||||
super().display_stop()
|
||||
|
||||
def snapshot(self, path=None, formats=0, quality=50):
|
||||
if path is None:
|
||||
_data = super().snapshot(formats=formats, quality=quality)
|
||||
if formats >= 2:
|
||||
return b'data:image/jpg;base64,' + base64.b64encode(_data)
|
||||
else:
|
||||
return _data
|
||||
else:
|
||||
return super().snapshot(path, quality=50)
|
||||
|
||||
Reference in New Issue
Block a user