更新SANT的摄像头,支持usb获取,修复文本清屏刷新问题
This commit is contained in:
@@ -11,6 +11,7 @@ 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, frame=1):
|
||||
@@ -43,3 +44,26 @@ class GC032A(Camera):
|
||||
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)
|
||||
|
||||
@@ -10,6 +10,8 @@ from tftlcd import LCD15
|
||||
|
||||
class ST7789(uframebuf.FrameBuffer_Uincode):
|
||||
def __init__(self, width=240, height=240, reset=None, backlight=None, direction=1, font_address=0x700000):
|
||||
self.display = LCD15(portrait=direction)
|
||||
self.display.deinit()
|
||||
if reset is not None:
|
||||
reset(0, 50)
|
||||
reset(1, 100)
|
||||
|
||||
Reference in New Issue
Block a user