From f7058c59f7bb4e7c4848d14f9f7f8a5216e88746 Mon Sep 17 00:00:00 2001 From: uhi22 Date: Fri, 30 Jun 2023 22:55:58 +0200 Subject: [PATCH] feature: try to SDP already after the setkey, to avoid the need for GetKey. Longer timeout for pairing time. --- connMgr.py | 3 ++- pyPlcHomeplug.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/connMgr.py b/connMgr.py index 15bad92..361ea1a 100644 --- a/connMgr.py +++ b/connMgr.py @@ -28,6 +28,7 @@ CONNMGR_CYCLES_PER_SECOND = 33 # 33 cycles for one second, is 30ms call cycle CONNMGR_TIMER_MAX = (5*33) # 5 seconds until an OkReport is forgotten. CONNMGR_TIMER_MAX_10s = (10*33) # 10 seconds until an OkReport is forgotten. CONNMGR_TIMER_MAX_15s = (15*33) # 15 seconds until an OkReport is forgotten. +CONNMGR_TIMER_MAX_20s = (20*33) # 20 seconds until an OkReport is forgotten. class connMgr(): @@ -126,7 +127,7 @@ class connMgr(): # The SetKey was sent to the local modem. This leads to restart of the # local modem, and potenially also for the remote modem. If both modems are up, # they need additional time to pair. We need to be patient during this process. */ - self.timerSlac = CONNMGR_TIMER_MAX_15s + self.timerSlac = CONNMGR_TIMER_MAX_20s def SdpOk(self): self.timerSDP = CONNMGR_TIMER_MAX diff --git a/pyPlcHomeplug.py b/pyPlcHomeplug.py index 429f41b..18f58f9 100644 --- a/pyPlcHomeplug.py +++ b/pyPlcHomeplug.py @@ -985,8 +985,8 @@ class pyPlcHomeplug(): self.enterState(STATE_INITIAL) def runSdpStateMachine(self): - if (self.connMgr.getConnectionLevel()<20): - # We have no AVLN established. It does not make sense to start SDP. + if (self.connMgr.getConnectionLevel()<15): + # We have no AVLN established and SLAC not ongoing. It does not make sense to start SDP. self.sdp_state = 0 return if (self.connMgr.getConnectionLevel()>20):