remove unnecessary timeouts

This commit is contained in:
Marianpol 2021-08-08 21:23:50 +02:00
parent 6554c69438
commit 99439c3430

View File

@ -1458,25 +1458,14 @@ class ELM:
# if Fn > 1:
# self.send_raw('at cfc1')
# print 'cfc1', raw_command
timeout1 = '25'
timeout2 = '200'
moreTimeout = ['10C0', '2181']
if raw_command[Fc].startswith('0'):
if uncutCommand in self.l1_cache.keys():
if uncutCommand in moreTimeout:
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ' ,R:' + self.l1_cache[uncutCommand] + ' ,T:' + timeout2) # we'll get only 1 frame: fc, ff or sf
else:
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ' ,R:' + self.l1_cache[uncutCommand] + ' ,T:' + timeout1) # we'll get only 1 frame: fc, ff or sf
else:
if uncutCommand in moreTimeout:
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ' ,T:' + timeout2)
else:
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ' ,T:' + timeout1 )
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ',R:' + self.l1_cache[uncutCommand])
else:
frsp = self.send_raw ('STPX D:' + raw_command[Fc])
if raw_command[Fc].startswith('1'):
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ',R:' + '1' + ' ,T:50')
frsp = self.send_raw ('STPX D:' + raw_command[Fc] + ',R:' + '1')
while Fc < Fn:
# if Fn > 1 and (Fn - Fc) == 1:
@ -1552,11 +1541,11 @@ class ELM:
if burstSizeCommand.endswith(raw_command[-1]):
if uncutCommand in self.l1_cache.keys():
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand + ",R:" + self.l1_cache[uncutCommand] + ' ,T:50'
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand + ",R:" + self.l1_cache[uncutCommand]
else:
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand + ' ,T:50'
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand
else:
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand + ",R:1" + ' ,T:50'
burstSizeCommandRequest = 'STPX D:' + burstSizeCommand + ",R:1"
# Ensure time gap between frames according to FlowControl
tc = time.time() # current time
@ -2089,6 +2078,7 @@ class ELM:
self.check_answer (self.cmd ("at fc sm 1"))
self.check_answer (self.cmd ("at st ff")) # reset adaptive timing step 1
self.check_answer (self.cmd ("at at 0")) # reset adaptive timing step 2
# self.check_answer (self.cmd ("STCFCPA " + TXa + ", " + RXa))
# some models of cars may have different CAN buses
if 'brp' in ecu.keys () and '1' in ecu['brp'] and '0' in ecu['brp']: # double brp
@ -2110,12 +2100,6 @@ class ELM:
self.check_answer (self.cmd ("at at 1")) # reset adaptive timing step 3
self.check_answer (self.cmd ("at cra " + RXa))
self.check_answer (self.cmd ("STCFCPA " + TXa + ", " + RXa))
self.send_raw("STFBA 763037F01, 7FFFFFFFF")
self.check_answer (self.cmd ("at sh 35C"))
self.send_raw ("FA 40 00 00 00 20 60 04")
self.check_answer (self.cmd ("at sh " + TXa))
# self.send_raw("STFBA 7E80040, 7FFF8F8")
self.check_adapter ()