From 35a7669dd26b7d0009dfc268845f3cda49035e9c Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Thu, 9 Jan 2025 19:16:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0SANT=E5=BA=93=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../micropython_esp32s3/origin/build/lib/sant_bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/boards/default_src/micropython_esp32s3/origin/build/lib/sant_bot.py b/boards/default_src/micropython_esp32s3/origin/build/lib/sant_bot.py index 8c95700a..73a369cc 100644 --- a/boards/default_src/micropython_esp32s3/origin/build/lib/sant_bot.py +++ b/boards/default_src/micropython_esp32s3/origin/build/lib/sant_bot.py @@ -5,6 +5,9 @@ Micropython library for the SANT_WCH(---) ======================================================= @dahanzimin From the Mixly Team """ +import time +from micropython import const + _BOT035_ADDRESS = const(0x13) _BOT5_TOUCH = const(0x01) _BOT035_ADC = const(0x05) @@ -17,6 +20,7 @@ _BOT035_STR = const(0x18) class BOT035: def __init__(self, i2c_bus): self._i2c = i2c_bus + self._touchs = [self.touch(0), self.touch(1)] def _wreg(self, reg, val): '''Write memory address''' @@ -38,10 +42,10 @@ class BOT035: def touched(self, index, value=600): return self.touch(index, value) - def touch_slide(self): + def touch_slide(self, comp=1.2): values = [] for i in range(30): - values.append((self.touch(1) - self._touchs[1]) - (self.touch(0) - self._touchs[0])) + values.append((self.touch(1) - self._touchs[1]) * comp - (self.touch(0) - self._touchs[0])) return round(sorted(values)[15] / 10) def usben(self, index=1, duty=None, freq=None):