From b82b4d6b3f5c1e2a6f010f04c8d5fa146267b303 Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Wed, 5 Mar 2025 19:24:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20MINI=20=E6=94=AF=E6=8C=81v?= =?UTF-8?q?2.9=E5=8D=8F=E5=9B=BA=E4=BB=B6=EF=BC=8C=E5=8F=8A=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9F=A5=E7=9C=8B=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../origin/build/lib/mini_bot.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py b/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py index 1eceecd5..ad8a4b6a 100644 --- a/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py +++ b/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py @@ -35,7 +35,7 @@ class BOT035(FrameBuffer): self._buffer = bytearray(12) self._brightness = brightness self._touchs = [self.touch(0), self.touch(1)] - self._version = True if self._rreg(0x00) == 0x27 else False + self._version = True if self._rreg(0x00) >= 0x27 else False super().__init__(self._buffer, _LEDS_W, _LEDS_H, MONO_VLSB) self.reset() self.show() @@ -231,6 +231,17 @@ class BOT035(FrameBuffer): self._i2c.writeto(_BOT035_ADDRESS, reg.to_bytes(1, 'little')) return self._i2c.readfrom(_BOT035_ADDRESS, nbytes)[0] + def version(self): + _ver = self._rreg(0x00) + if _ver == 0x26: + return "v1.7", "Only supports CDC serial port" + elif _ver == 0x27: + return "v2.5", "Composite devices (CDC, keyboard and mouse)" + elif _ver == 0x28: + return "v2.9", "Composite devices (CDC, HID, WEBUSB, Keyboard and mouse)" + else: + return "vx.x", "Unknown, awaiting update" + def reset(self): """Reset SPK, PWM, HID registers to default state""" self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_SPK, b'\x0A\x00\x00\x00\x20\x4E\x64\x64')