瀏覽代碼

Fix minitouch pressure range for low max_pressure

Avoid ValueError when max_pressure is lower than 20.
kristin0512 1 周之前
父節點
當前提交
a787a58abf
共有 1 個文件被更改,包括 2 次插入 和 2 次删除
  1. 2 2
      module/device/method/minitouch.py

+ 2 - 2
module/device/method/minitouch.py

@@ -411,7 +411,7 @@ class Minitouch(Connection):
 
     def _humanized_pressure(self) -> int:
         top = getattr(self, 'max_pressure', 100) or 100
-        return random.randint(max(20, top // 2), top)
+        return random.randint(max(1, top // 2), top)
 
     def _humanized_dwell(self) -> int:
         return int(random.triangular(45, 130, 65))
@@ -634,4 +634,4 @@ class Minitouch(Connection):
 
 if __name__ == '__main__':
     mm = Minitouch(config='oas1')
-    mm.click_minitouch(200, 150)
+    mm.click_minitouch(200, 150)