Fix
This commit is contained in:
parent
3ca2c7b201
commit
d36c6558bd
@ -24,6 +24,7 @@ import mod_db_manager
|
|||||||
|
|
||||||
from xml.dom.minidom import parse
|
from xml.dom.minidom import parse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from collections import OrderedDict
|
||||||
from mod_utils import show_doc
|
from mod_utils import show_doc
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
#import xml.etree.ElementTree as et
|
#import xml.etree.ElementTree as et
|
||||||
@ -432,7 +433,8 @@ class ECU:
|
|||||||
tb = time.time() #time of begining
|
tb = time.time() #time of begining
|
||||||
|
|
||||||
if len(datarefs)==0 and 'DE' not in path: return
|
if len(datarefs)==0 and 'DE' not in path: return
|
||||||
|
self.elm.clear_cache()
|
||||||
|
tmpArray = OrderedDict()
|
||||||
|
|
||||||
if mod_globals.opt_csv and mod_globals.opt_csv_only:
|
if mod_globals.opt_csv and mod_globals.opt_csv_only:
|
||||||
print "Data is sending directly to csv-file"
|
print "Data is sending directly to csv-file"
|
||||||
@ -458,8 +460,16 @@ class ECU:
|
|||||||
csvf.flush()
|
csvf.flush()
|
||||||
csvline = datetime.now().strftime("%H:%M:%S.%f")
|
csvline = datetime.now().strftime("%H:%M:%S.%f")
|
||||||
|
|
||||||
self.elm.clear_cache()
|
if mod_globals.opt_perform:
|
||||||
|
if not tmpArray or tmpArray.keys()[-1].startswith('21') :
|
||||||
|
for x in self.elm.rsp_cache.keys():
|
||||||
|
if (x.startswith('22') and len(x) > 6) or x.startswith('21') or len(self.elm.rsp_cache) == 1:
|
||||||
|
tmpArray[x] = x
|
||||||
|
if len(self.elm.currentScreenDataIds) > 1:
|
||||||
|
tmpArray["22" + self.elm.currentScreenDataIds[-1][0].id] = "22" + self.elm.currentScreenDataIds[-1][0].id
|
||||||
|
|
||||||
|
self.elm.clear_cache()
|
||||||
|
if not (tmpArray and mod_globals.opt_csv_only):
|
||||||
for dr in datarefs:
|
for dr in datarefs:
|
||||||
datastr = dr.name
|
datastr = dr.name
|
||||||
help = dr.type
|
help = dr.type
|
||||||
@ -500,6 +510,9 @@ class ECU:
|
|||||||
strlst.append('\t'+line[i*W:(i+1)*W])
|
strlst.append('\t'+line[i*W:(i+1)*W])
|
||||||
i=i+1
|
i=i+1
|
||||||
strlst.append('')
|
strlst.append('')
|
||||||
|
else:
|
||||||
|
for req in tmpArray:
|
||||||
|
self.elm.request(req)
|
||||||
|
|
||||||
if not (mod_globals.opt_csv and mod_globals.opt_csv_only):
|
if not (mod_globals.opt_csv and mod_globals.opt_csv_only):
|
||||||
newScreen = initScreen
|
newScreen = initScreen
|
||||||
@ -580,6 +593,15 @@ class ECU:
|
|||||||
kb.set_normal_term()
|
kb.set_normal_term()
|
||||||
if mod_globals.opt_csv and csvf!=0:
|
if mod_globals.opt_csv and csvf!=0:
|
||||||
csvf.close()
|
csvf.close()
|
||||||
|
# self.elm.vf.read()
|
||||||
|
# with open ("./logs/ecu_" + mod_globals.opt_log, "r") as f:
|
||||||
|
# for line in f:
|
||||||
|
# print line
|
||||||
|
for line in self.elm.vf:
|
||||||
|
print line
|
||||||
|
raw_input()
|
||||||
|
# raw_input('2322232')
|
||||||
|
# self.elm.vf.read()
|
||||||
if "DTC" in path:
|
if "DTC" in path:
|
||||||
mod_globals.ext_cur_DTC = "000000"
|
mod_globals.ext_cur_DTC = "000000"
|
||||||
return
|
return
|
||||||
|
@ -575,7 +575,7 @@ class ELM:
|
|||||||
|
|
||||||
if len(mod_globals.opt_log)>0: # and mod_globals.opt_demo==False:
|
if len(mod_globals.opt_log)>0: # and mod_globals.opt_demo==False:
|
||||||
self.lf = open ("./logs/elm_" + mod_globals.opt_log, "at")
|
self.lf = open ("./logs/elm_" + mod_globals.opt_log, "at")
|
||||||
self.vf = open ("./logs/ecu_" + mod_globals.opt_log, "at")
|
self.vf = open ("./logs/ecu_" + mod_globals.opt_log, "at+")
|
||||||
|
|
||||||
if mod_globals.opt_debug and mod_globals.debug_file==None:
|
if mod_globals.opt_debug and mod_globals.debug_file==None:
|
||||||
mod_globals.debug_file = open ("./logs/debug.txt", "at")
|
mod_globals.debug_file = open ("./logs/debug.txt", "at")
|
||||||
@ -590,7 +590,7 @@ class ELM:
|
|||||||
|
|
||||||
# check OBDLink
|
# check OBDLink
|
||||||
elm_rsp = self.cmd("STPR")
|
elm_rsp = self.cmd("STPR")
|
||||||
if '?' not in elm_rsp:
|
if elm_rsp and '?' not in elm_rsp:
|
||||||
mod_globals.opt_obdlink = True
|
mod_globals.opt_obdlink = True
|
||||||
|
|
||||||
# check STN
|
# check STN
|
||||||
@ -599,10 +599,10 @@ class ELM:
|
|||||||
mod_globals.opt_stn = True
|
mod_globals.opt_stn = True
|
||||||
|
|
||||||
# Max out the UART speed for the fastest polling rate
|
# Max out the UART speed for the fastest polling rate
|
||||||
if mod_globals.opt_csv:
|
if mod_globals.opt_csv and not mod_globals.opt_demo:
|
||||||
if mod_globals.opt_obdlink:
|
if mod_globals.opt_obdlink:
|
||||||
self.port.soft_boudrate(2000000)
|
self.port.soft_boudrate(2000000)
|
||||||
elif self.port.portType == 0:
|
else:
|
||||||
self.port.soft_boudrate(230400)
|
self.port.soft_boudrate(230400)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
@ -1205,8 +1205,9 @@ class ELM:
|
|||||||
cmd_len = len (command) / 2
|
cmd_len = len (command) / 2
|
||||||
if cmd_len < 8: # single frame
|
if cmd_len < 8: # single frame
|
||||||
# check L1 cache here
|
# check L1 cache here
|
||||||
if isCommandInCache and int('0x' + self.l1_cache[commandString], 16) < 16:
|
# if isCommandInCache and int('0x' + self.l1_cache[commandString], 16) < 16:
|
||||||
raw_command.append (("%0.2X" % cmd_len) + command + self.l1_cache[command])
|
if isCommandInCache:
|
||||||
|
raw_command.append ("STPX D:" + ("%0.2X" % cmd_len) + command + ",R:" +self.l1_cache[command])
|
||||||
else:
|
else:
|
||||||
raw_command.append (("%0.2X" % cmd_len) + command)
|
raw_command.append (("%0.2X" % cmd_len) + command)
|
||||||
else:
|
else:
|
||||||
@ -1223,16 +1224,21 @@ class ELM:
|
|||||||
# add response frames number to each frame to increase polling
|
# add response frames number to each frame to increase polling
|
||||||
if mod_globals.opt_obdlink and mod_globals.opt_perform:
|
if mod_globals.opt_obdlink and mod_globals.opt_perform:
|
||||||
if commandString[:2] in AllowedList and isCommandInCache:
|
if commandString[:2] in AllowedList and isCommandInCache:
|
||||||
if int('0x' + self.l1_cache[commandString], 16) < 16:
|
|
||||||
for index in range(len(raw_command) - 1):
|
|
||||||
raw_command[index] = raw_command[index] + '1'
|
|
||||||
raw_command[-1] = raw_command[-1] + self.l1_cache[commandString]
|
|
||||||
else:
|
|
||||||
readyFrame = ''
|
readyFrame = ''
|
||||||
for f in raw_command:
|
for f in raw_command:
|
||||||
readyFrame += f
|
readyFrame += f
|
||||||
raw_command = ["STPX D:" + readyFrame + ",R:" + self.l1_cache[commandString]]
|
raw_command = ["STPX D:" + readyFrame + ",R:" + self.l1_cache[commandString]]
|
||||||
|
|
||||||
|
# if int('0x' + self.l1_cache[commandString], 16) < 16:
|
||||||
|
# for index in range(len(raw_command) - 1):
|
||||||
|
# raw_command[index] = raw_command[index] + '1'
|
||||||
|
# raw_command[-1] = raw_command[-1] + self.l1_cache[commandString]
|
||||||
|
# else:
|
||||||
|
# readyFrame = ''
|
||||||
|
# for f in raw_command:
|
||||||
|
# readyFrame += f
|
||||||
|
# raw_command = ["STPX D:" + readyFrame + ",R:" + self.l1_cache[commandString]]
|
||||||
|
|
||||||
responses = []
|
responses = []
|
||||||
|
|
||||||
# send farmes
|
# send farmes
|
||||||
@ -1301,9 +1307,9 @@ class ELM:
|
|||||||
|
|
||||||
# populate L1 cache
|
# populate L1 cache
|
||||||
if noerrors and commandString[:2] in AllowedList and not mod_globals.opt_n1c:
|
if noerrors and commandString[:2] in AllowedList and not mod_globals.opt_n1c:
|
||||||
if nframes < 16:
|
# if nframes < 16:
|
||||||
self.l1_cache[commandString] = str(hex(nframes))[2:].upper()
|
# self.l1_cache[commandString] = str(hex(nframes))[2:].upper()
|
||||||
else: #for OBDLink STPX command
|
# else: #for OBDLink STPX command
|
||||||
self.l1_cache[commandString] = str(nframes)
|
self.l1_cache[commandString] = str(nframes)
|
||||||
|
|
||||||
if len (result) / 2 >= nbytes and noerrors:
|
if len (result) / 2 >= nbytes and noerrors:
|
||||||
@ -1962,6 +1968,11 @@ class ELM:
|
|||||||
self.check_answer (self.cmd ("at at 1")) # reset adaptive timing step 3
|
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 ("at cra " + RXa))
|
||||||
|
|
||||||
|
|
||||||
|
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.check_adapter ()
|
self.check_adapter ()
|
||||||
|
|
||||||
def init_iso(self):
|
def init_iso(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user