From 72bdb86b9ce59e6fc7f7235866a64640589317ed Mon Sep 17 00:00:00 2001 From: Svein Seldal Date: Tue, 14 May 2024 15:57:53 +0200 Subject: [PATCH 1/2] Add configurable pause after sending SDO request --- canopen/sdo/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/canopen/sdo/client.py b/canopen/sdo/client.py index d64a1c14..6fc1c562 100644 --- a/canopen/sdo/client.py +++ b/canopen/sdo/client.py @@ -28,6 +28,9 @@ class SdoClient(SdoBase): #: Seconds to wait before sending a request, for rate limiting PAUSE_BEFORE_SEND = 0.0 + #: Seconds to wait after sending a request + PAUSE_AFTER_SEND = 0.0 + def __init__(self, rx_cobid, tx_cobid, od): """ :param int rx_cobid: @@ -56,7 +59,8 @@ def send_request(self, request): if not retries_left: raise logger.info(str(e)) - time.sleep(0.1) + if self.PAUSE_AFTER_SEND: + time.sleep(self.PAUSE_AFTER_SEND) else: break From 8389c38083452ed527002aa8fd45cbed7142d992 Mon Sep 17 00:00:00 2001 From: Svein Seldal Date: Thu, 16 May 2024 12:26:09 +0200 Subject: [PATCH 2/2] Fix incorrect default pause value --- canopen/sdo/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canopen/sdo/client.py b/canopen/sdo/client.py index 6fc1c562..a7ac86a0 100644 --- a/canopen/sdo/client.py +++ b/canopen/sdo/client.py @@ -29,7 +29,7 @@ class SdoClient(SdoBase): PAUSE_BEFORE_SEND = 0.0 #: Seconds to wait after sending a request - PAUSE_AFTER_SEND = 0.0 + PAUSE_AFTER_SEND = 0.1 def __init__(self, rx_cobid, tx_cobid, od): """