From 5ded40ed21d21195b389f290b13354da84870371 Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Tue, 17 Jun 2025 19:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0SANT=E7=9A=84=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4=EF=BC=8C=E6=94=AF=E6=8C=81usb=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=96=87=E6=9C=AC=E6=B8=85?= =?UTF-8?q?=E5=B1=8F=E5=88=B7=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../micropython/origin/build/lib/uframebuf.py | 7 +----- .../origin/build/lib/camera.py | 24 +++++++++++++++++++ .../origin/build/lib/st7789_cf.py | 2 ++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/boards/default_src/micropython/origin/build/lib/uframebuf.py b/boards/default_src/micropython/origin/build/lib/uframebuf.py index bf3647df..b2a17661 100644 --- a/boards/default_src/micropython/origin/build/lib/uframebuf.py +++ b/boards/default_src/micropython/origin/build/lib/uframebuf.py @@ -417,7 +417,6 @@ class FrameBuffer_Uincode(FrameBuffer_Base): if sync: self.fill(bg_color, sync=False) self.set_buffer(data, sync) else: - yy = y if size is None: font_len, font_buffer = self._take_buffer(str(data), space, 1) size = min((self.width // font_len) if font_len > 0 else 1, self.height // self._font.height) @@ -425,11 +424,7 @@ class FrameBuffer_Uincode(FrameBuffer_Base): font_len, font_buffer = self._take_buffer(str(data), space, size) x = (self.width - font_len + space) // 2 if center else x y = (self.height - self._font.height * size) // 2 if y is None else y - if sync: - if yy is None: - self.fill(bg_color, sync=False) - else: - self.fill_rect(x - 1, y - 1, font_len + 2, font_buffer[0][1][1] * size + 2, bg_color, sync=False) + if sync: self.fill(bg_color, sync=False) for buffer in font_buffer: #Display character self.bitmap(buffer, x, y, size, bold, color) x = buffer[1][0] * size + x + space diff --git a/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py b/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py index 5de07499..8f690523 100644 --- a/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py +++ b/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py @@ -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) diff --git a/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py b/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py index b16e98b5..838cbd76 100644 --- a/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py +++ b/boards/default_src/micropython_esp32s3/origin/build/lib/st7789_cf.py @@ -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)