mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-05 01:00:23 +02:00
BLEThread.run: Reduce notification wait time from 1s to 1ms
Now notification wait has 1 second timeout. This might be too long for Lego Boost. Reduce it to 1 millisecond. If BLE device does not send out any notification, bluepy-scratch-link wait for 1 second and during this wait, write or read message from Scratch is not sent to Boost. This is not an issue for micro:bit since micro:bit sends out notifications frequently, the notification wait completes before 1 second timeout. It was reported that Lego Boost has a few seconds latency between Scratch motor control command execution to Lego Boost motor move. To try out smaller timeout, reduce the value. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
This commit is contained in:
@@ -361,7 +361,7 @@ class BLESession(Session):
|
||||
logger.debug("getting lock for waitForNotification")
|
||||
with self.session.lock:
|
||||
logger.debug("before waitForNotification")
|
||||
self.session.perip.waitForNotifications(1.0)
|
||||
self.session.perip.waitForNotifications(0.0001)
|
||||
logger.debug("after waitForNotification")
|
||||
logger.debug("released lock for waitForNotification")
|
||||
except Exception as e:
|
||||
|
Reference in New Issue
Block a user