From d9b870bf02cc9999e4291b4497e643110a1190fa Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Thu, 30 Oct 2025 20:46:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0sant=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=90=8C=E6=AD=A5=E6=98=BE=E7=A4=BA=E6=9C=AA?= =?UTF-8?q?=E6=B8=85=E5=B1=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../micropython_esp32s3/origin/build/lib/camera.py | 3 +-- .../micropython_esp32s3/origin/build/lib/st7789_cf.py | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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 95f3a643..d31232b6 100644 --- a/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py +++ b/boards/default_src/micropython_esp32s3/origin/build/lib/camera.py @@ -25,9 +25,8 @@ class Camera(Camera): onboard_bot.cam_en(1, 150) super().__init__(frame_size=frame_size, pixel_format=pixel_format, **kwargs) self.set_hmirror(not hmirror) - time.sleep_ms(50) + time.sleep_ms(150) self.set_vflip(not vflip) - time.sleep_ms(50) SoftI2C(scl=Pin(47), sda=Pin(48), freq=400000) # 恢复I2C for _ in range(skip_frame): super().capture() 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 a5b7adf1..8f30d2d9 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 @@ -37,11 +37,15 @@ class ST7789(uframebuf.FrameBuffer_Uincode): def display(self, data=None, x=None, y=None, rotation=0, sync=True): if type(data) is str: data = Image.open(data, rotation) + if sync: self.fill(0x0, sync=False) self.blit_rgb565(data.image, data.width, data.height, x, y) if sync: self.show() - def screenshot(self): - return IMG(memoryview(self._buffer), self.width, self.height) + def screenshot(self, x=0, y=0, w=None, h=None): + if (w is None and h is None): + return IMG(memoryview(self._buffer), self.width, self.height) + else: + return IMG(memoryview(self.crop_rgb565(x,y,w,h)), w, h) def _write(self, cmd, dat=None): self.dc.off()