This commit is contained in:
fredqian
2025-10-30 20:51:20 +08:00
2 changed files with 7 additions and 4 deletions

View File

@@ -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()

View File

@@ -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()