fix some issues
This commit is contained in:
parent
4449cc8b0f
commit
d76a0a6cdf
@ -105,6 +105,12 @@ def optParser():
|
|||||||
default=False,
|
default=False,
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
|
||||||
|
parser.add_argument("--exp",
|
||||||
|
help="Explore options",
|
||||||
|
dest="exp",
|
||||||
|
default=False,
|
||||||
|
action="store_true")
|
||||||
|
|
||||||
parser.add_argument("--vin",
|
parser.add_argument("--vin",
|
||||||
help="vin number",
|
help="vin number",
|
||||||
dest="vinnum",
|
dest="vinnum",
|
||||||
@ -160,6 +166,7 @@ def optParser():
|
|||||||
mod_globals.opt_verbose2 = options.verbose2
|
mod_globals.opt_verbose2 = options.verbose2
|
||||||
mod_globals.opt_ref = options.ref
|
mod_globals.opt_ref = options.ref
|
||||||
mod_globals.opt_mtc = options.mtc
|
mod_globals.opt_mtc = options.mtc
|
||||||
|
mod_globals.opt_exp = options.exp
|
||||||
|
|
||||||
if options.dev=='' or len(options.dev)!=4 or options.dev[0:2]!='10':
|
if options.dev=='' or len(options.dev)!=4 or options.dev[0:2]!='10':
|
||||||
mod_globals.opt_dev = False
|
mod_globals.opt_dev = False
|
||||||
@ -305,9 +312,11 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print("%2s : %s : " % (m['idf'],m['sref']))
|
print("%2s : %s : " % (m['idf'],m['sref']))
|
||||||
|
|
||||||
#for option in mtc:
|
if mod_globals.opt_exp:
|
||||||
# acf_MTC_optionsExplorer( de, option )
|
for option in sorted(mtc):
|
||||||
|
res = acf_MTC_optionsExplorer( module_list, option, mtc )
|
||||||
|
for l in res:
|
||||||
|
print( l )
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -230,7 +230,7 @@ def acf_MTC_findDiff( m, mtc, elm ):
|
|||||||
#acf_form_commands( m, cu, op )
|
#acf_form_commands( m, cu, op )
|
||||||
break
|
break
|
||||||
|
|
||||||
def acf_MTC_optinInfluence( m, option ):
|
def acf_MTC_optinInfluence( m, option, allmtc ):
|
||||||
''' m - module definition map '''
|
''' m - module definition map '''
|
||||||
''' option - option name from MTC list '''
|
''' option - option name from MTC list '''
|
||||||
''' this function finds dependent parameters in one module'''
|
''' this function finds dependent parameters in one module'''
|
||||||
@ -260,7 +260,7 @@ def acf_MTC_optinInfluence( m, option ):
|
|||||||
#check every mtc
|
#check every mtc
|
||||||
for op in cu.opts:
|
for op in cu.opts:
|
||||||
if option not in op.MTC: continue
|
if option not in op.MTC: continue
|
||||||
res = acf_MTC_compare(op.MTC, option)
|
res = acf_MTC_compare(op.MTC, allmtc)
|
||||||
if res:
|
if res:
|
||||||
tmpMTC = op.MTC.split()
|
tmpMTC = op.MTC.split()
|
||||||
if op.MTC.startswith('SAUF'): continue
|
if op.MTC.startswith('SAUF'): continue
|
||||||
@ -271,22 +271,25 @@ def acf_MTC_optinInfluence( m, option ):
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def acf_MTC_optionsExplorer( de, option ):
|
def acf_MTC_optionsExplorer( de, option, allmtc ):
|
||||||
''' de - list of all ecus '''
|
''' de - list of all ecus '''
|
||||||
''' option - option name from MTC list '''
|
''' option - option name from MTC list '''
|
||||||
''' this function finds dependent parameters in every module'''
|
''' this function finds dependent parameters in every module'''
|
||||||
|
|
||||||
print('################### ', '%-10s'%(option), ' #########################')
|
res = []
|
||||||
|
|
||||||
|
res.append(f'################### {option:10} #########################')
|
||||||
|
|
||||||
for m in de:
|
for m in de:
|
||||||
if 'sref' not in list(m.keys()) or m['sref']=='': continue
|
if 'sref' not in list(m.keys()) or m['sref']=='': continue
|
||||||
if 'sref' in list(m.keys()):
|
if 'sref' in list(m.keys()):
|
||||||
if 'mo' in list(m.keys()) and m['mo']!='':
|
if 'mo' in list(m.keys()) and m['mo']!='':
|
||||||
out = acf_MTC_optinInfluence( m, option )
|
out = acf_MTC_optinInfluence( m, option, allmtc )
|
||||||
if len(out)>0:
|
if len(out)>0:
|
||||||
print('-'*30," Family : ",m['idf'], ' : ', m['fam_txt'])
|
res.append(f"--------------------- Family : {m['idf']} : {m['fam_txt']}")
|
||||||
print(out)
|
res.append(out)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1197,10 +1197,10 @@ def AutoIdents_distance( DiagVersion, Supplier, Soft, Version, ai ):
|
|||||||
#catch not hex supplier with len 6
|
#catch not hex supplier with len 6
|
||||||
pass
|
pass
|
||||||
|
|
||||||
d = distance( DiagVersion, ai['DiagVersion']) * 0.25
|
d = distance( DiagVersion, ai['DiagVersion']) * 0.35
|
||||||
d = d + distance( Supplier, ai['Supplier']) * 0.25
|
d = d + distance( Supplier, ai['Supplier']) * 0.35
|
||||||
d = d + distance( Soft, ai['Soft']) * 0.25
|
d = d + distance( Soft, ai['Soft']) * 0.15
|
||||||
d = d + distance( Version, ai['Version']) * 0.25
|
d = d + distance( Version, ai['Version']) * 0.15
|
||||||
|
|
||||||
return round( d, 4 )
|
return round( d, 4 )
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ class FindDialog (tkinter.simpledialog.Dialog):
|
|||||||
def __init__(self, parent, ecu ):
|
def __init__(self, parent, ecu ):
|
||||||
|
|
||||||
self.ecu = ecu
|
self.ecu = ecu
|
||||||
|
self.choise = ''
|
||||||
|
|
||||||
self.top = tk.Toplevel (parent)
|
self.top = tk.Toplevel (parent)
|
||||||
self.top.title ('Find Dialog')
|
self.top.title ('Find Dialog')
|
||||||
@ -1083,6 +1084,12 @@ class DDTScreen (tk.Frame):
|
|||||||
self.root.wait_window (dialog.top)
|
self.root.wait_window (dialog.top)
|
||||||
|
|
||||||
def find(self):
|
def find(self):
|
||||||
|
|
||||||
|
restart = False
|
||||||
|
if self.start:
|
||||||
|
self.startStop()
|
||||||
|
restart = True
|
||||||
|
|
||||||
scr_name = FindDialog(self.root, self.decu ).show()
|
scr_name = FindDialog(self.root, self.decu ).show()
|
||||||
if '@' in scr_name:
|
if '@' in scr_name:
|
||||||
key = scr_name.split('@')[0]
|
key = scr_name.split('@')[0]
|
||||||
@ -1090,6 +1097,10 @@ class DDTScreen (tk.Frame):
|
|||||||
#self.loadSyntheticScreen (self.Screens[key])
|
#self.loadSyntheticScreen (self.Screens[key])
|
||||||
#else:
|
#else:
|
||||||
self.loadScreen (self.Screens[key])
|
self.loadScreen (self.Screens[key])
|
||||||
|
|
||||||
|
if restart:
|
||||||
|
self.startStop()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def torqpids(self):
|
def torqpids(self):
|
||||||
@ -1417,6 +1428,19 @@ class DDTScreen (tk.Frame):
|
|||||||
self.loadSyntheticScreen(scr)
|
self.loadSyntheticScreen(scr)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
#debug
|
||||||
|
#deb_time1 = time.time()
|
||||||
|
#print( "#"*50 )
|
||||||
|
|
||||||
|
# stop ratary. Do not read ELM
|
||||||
|
restart = False
|
||||||
|
if self.start:
|
||||||
|
self.startStop()
|
||||||
|
restart = True
|
||||||
|
|
||||||
|
#debug
|
||||||
|
#print( f"DEBUG POINT1: {time.time()-deb_time1}")
|
||||||
|
|
||||||
ns = {'ns0': 'http://www-diag.renault.com/2002/ECU',
|
ns = {'ns0': 'http://www-diag.renault.com/2002/ECU',
|
||||||
'ns1': 'http://www-diag.renault.com/2002/screens'}
|
'ns1': 'http://www-diag.renault.com/2002/screens'}
|
||||||
|
|
||||||
@ -1446,7 +1470,6 @@ class DDTScreen (tk.Frame):
|
|||||||
max_y = h
|
max_y = h
|
||||||
# print xrLeft, xrTop, xrHeight, xrWidth
|
# print xrLeft, xrTop, xrHeight, xrWidth
|
||||||
|
|
||||||
deb_time1 = time.time()
|
|
||||||
# main frame re-create
|
# main frame re-create
|
||||||
self.ddt.delete ('all')
|
self.ddt.delete ('all')
|
||||||
self.ddt.update_idletasks ()
|
self.ddt.update_idletasks ()
|
||||||
@ -1855,6 +1878,9 @@ class DDTScreen (tk.Frame):
|
|||||||
# clear elm cache
|
# clear elm cache
|
||||||
self.decu.clearELMcache ()
|
self.decu.clearELMcache ()
|
||||||
|
|
||||||
|
if restart:
|
||||||
|
self.startStop()
|
||||||
|
|
||||||
# request to update dInputs
|
# request to update dInputs
|
||||||
self.update_dInputs ()
|
self.update_dInputs ()
|
||||||
|
|
||||||
@ -1874,9 +1900,14 @@ class DDTScreen (tk.Frame):
|
|||||||
if len (self.sReq_lst):
|
if len (self.sReq_lst):
|
||||||
self.startScreen ()
|
self.startScreen ()
|
||||||
|
|
||||||
|
|
||||||
def loadSyntheticScreen(self, rq):
|
def loadSyntheticScreen(self, rq):
|
||||||
|
|
||||||
|
# stop ratary. Do not read ELM
|
||||||
|
restart = False
|
||||||
|
if self.start:
|
||||||
|
self.startStop()
|
||||||
|
restart = True
|
||||||
|
|
||||||
read_cmd = self.decu.requests[rq].SentBytes
|
read_cmd = self.decu.requests[rq].SentBytes
|
||||||
if read_cmd[:2]=='21':
|
if read_cmd[:2]=='21':
|
||||||
read_cmd = read_cmd[:4]
|
read_cmd = read_cmd[:4]
|
||||||
@ -2035,6 +2066,10 @@ class DDTScreen (tk.Frame):
|
|||||||
# clear elm cache
|
# clear elm cache
|
||||||
self.decu.clearELMcache ()
|
self.decu.clearELMcache ()
|
||||||
|
|
||||||
|
# restart if need
|
||||||
|
if restart:
|
||||||
|
self.startStop()
|
||||||
|
|
||||||
# request to update dInputs
|
# request to update dInputs
|
||||||
self.update_dInputs ()
|
self.update_dInputs ()
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ class Port:
|
|||||||
print('*' * 40)
|
print('*' * 40)
|
||||||
print('* Connection to ELM was lost')
|
print('* Connection to ELM was lost')
|
||||||
mod_globals.opt_demo = True
|
mod_globals.opt_demo = True
|
||||||
|
|
||||||
if type(byte) == str:
|
if type(byte) == str:
|
||||||
byte = byte.encode()
|
byte = byte.encode()
|
||||||
|
|
||||||
@ -485,6 +485,7 @@ class Port:
|
|||||||
self.hdr.timeout = 1
|
self.hdr.timeout = 1
|
||||||
self.hdr.baudrate = boudrate
|
self.hdr.baudrate = boudrate
|
||||||
|
|
||||||
|
time.sleep (0.1)
|
||||||
self.write ("\r")
|
self.write ("\r")
|
||||||
|
|
||||||
# search >
|
# search >
|
||||||
|
2
pyren3/mod_globals.py
Executable file → Normal file
2
pyren3/mod_globals.py
Executable file → Normal file
@ -36,6 +36,8 @@ opt_stn = False #STN(PIC24) ELM327 which has ability to automatically s
|
|||||||
opt_sd = False #separate doc files
|
opt_sd = False #separate doc files
|
||||||
opt_performance = False
|
opt_performance = False
|
||||||
opt_minordtc = False
|
opt_minordtc = False
|
||||||
|
opt_ref = "" #alternative ref set for acf
|
||||||
|
opt_mtc = "" #alternative mtc set for acf
|
||||||
dumpName = ""
|
dumpName = ""
|
||||||
|
|
||||||
state_scan = False
|
state_scan = False
|
||||||
|
@ -78,12 +78,12 @@ def optParser():
|
|||||||
default="")
|
default="")
|
||||||
|
|
||||||
parser.add_argument("-s",
|
parser.add_argument("-s",
|
||||||
help="com port speed configured on ELM {38400[default],57600,115200,230400,500000} DEPRECATED",
|
help="com port speed configured on ELM {38400[default],115200,230400,500000} DEPRECATED",
|
||||||
dest="speed",
|
dest="speed",
|
||||||
default="38400")
|
default="38400")
|
||||||
|
|
||||||
parser.add_argument("-r",
|
parser.add_argument("-r",
|
||||||
help="com port rate during diagnostic session {38400[default],57600,115200,230400,500000}",
|
help="com port rate during diagnostic session {38400[default],115200,230400,500000}",
|
||||||
dest="rate",
|
dest="rate",
|
||||||
default="38400",)
|
default="38400",)
|
||||||
|
|
||||||
|
@ -477,8 +477,8 @@ class tl:
|
|||||||
y1 = float(line['volt'][i*2+1])
|
y1 = float(line['volt'][i*2+1])
|
||||||
self.CV.create_line(tx + x0 * xm, ty + (ymax - y0) * ym, tx + x1 * xm, ty + (ymax - y1) * ym, width=1, fill=f )
|
self.CV.create_line(tx + x0 * xm, ty + (ymax - y0) * ym, tx + x1 * xm, ty + (ymax - y1) * ym, width=1, fill=f )
|
||||||
|
|
||||||
if hist:
|
#if hist:
|
||||||
return
|
# return
|
||||||
|
|
||||||
self.findPoints( line )
|
self.findPoints( line )
|
||||||
|
|
||||||
@ -498,6 +498,13 @@ class tl:
|
|||||||
except:
|
except:
|
||||||
Tc = int(line['temp'])
|
Tc = int(line['temp'])
|
||||||
|
|
||||||
|
# average interval among points
|
||||||
|
interval = (line['volt'][-2] - line['volt'][0]) / len(line['volt']) * 2
|
||||||
|
|
||||||
|
#points in 50ms (take in to account only odds)
|
||||||
|
# 50ms radius of zone for local min/max
|
||||||
|
radius = int(.1 / interval ) * 2 + 1
|
||||||
|
|
||||||
self.T0 = line['volt'][0]
|
self.T0 = line['volt'][0]
|
||||||
u = 2
|
u = 2
|
||||||
mean = 0
|
mean = 0
|
||||||
@ -509,29 +516,21 @@ class tl:
|
|||||||
self.V0 = mean // count
|
self.V0 = mean // count
|
||||||
|
|
||||||
# find first min
|
# find first min
|
||||||
min = line['volt'][u-1]
|
smin = min(list(line['volt'][u-5:u+radius:2]))
|
||||||
while line['volt'][u+1]-min < 0.25 and u<len(line['volt']):
|
while line['volt'][u+1]!=smin:
|
||||||
if line['volt'][u+1]<min:
|
|
||||||
min = line['volt'][u+1]
|
|
||||||
self.T1 = line['volt'][u]
|
|
||||||
u += 2
|
u += 2
|
||||||
self.V1 = min
|
self.T1 = line['volt'][u]
|
||||||
|
self.V1 = smin
|
||||||
|
|
||||||
# find first max
|
# find first max
|
||||||
max = min
|
while line['volt'][u+1]<max(list(line['volt'][u-1:u+radius:2])) and u<len(line['volt'])-radius-1:
|
||||||
while max - line['volt'][u+1] < 0.25 and u<len(line['volt']):
|
|
||||||
if line['volt'][u+1]>max:
|
|
||||||
max = line['volt'][u+1]
|
|
||||||
u += 2
|
u += 2
|
||||||
|
|
||||||
# find second min
|
# find second min
|
||||||
min = line['volt'][u-1]
|
while line['volt'][u+1]>min(list(line['volt'][u-1:u+radius:2])) and u<len(line['volt'])-radius-1:
|
||||||
while line['volt'][u+1]-min < 0.25 and u<len(line['volt']):
|
|
||||||
if line['volt'][u+1]<min:
|
|
||||||
min = line['volt'][u+1]
|
|
||||||
self.T2 = line['volt'][u]
|
|
||||||
u += 2
|
u += 2
|
||||||
self.V2 = min
|
self.T2 = line['volt'][u]
|
||||||
|
self.V2 = line['volt'][u+1]
|
||||||
|
|
||||||
self.vth1 = 0
|
self.vth1 = 0
|
||||||
tpol = [ 2.40384615e-09, -7.79428904e-08, -6.37383450e-06, 8.12208625e-05, 1.06745338e-02, 1.97290210e-01]
|
tpol = [ 2.40384615e-09, -7.79428904e-08, -6.37383450e-06, 8.12208625e-05, 1.06745338e-02, 1.97290210e-01]
|
||||||
@ -552,6 +551,7 @@ class tl:
|
|||||||
else:
|
else:
|
||||||
self.l_volt.config(fg='black', bg = "red")
|
self.l_volt.config(fg='black', bg = "red")
|
||||||
|
|
||||||
|
print( (self.V2-self.V1)/(self.T2-self.T1)/8*100, self.V1, self.V2)
|
||||||
return
|
return
|
||||||
|
|
||||||
def axis( self, top ):
|
def axis( self, top ):
|
||||||
@ -570,7 +570,7 @@ class tl:
|
|||||||
else:
|
else:
|
||||||
self.CV.create_line( tx+x*xm, ty, tx+x*xm, self.ch-ty, width=0, dash=(5,5), fill='lightgray')
|
self.CV.create_line( tx+x*xm, ty, tx+x*xm, self.ch-ty, width=0, dash=(5,5), fill='lightgray')
|
||||||
|
|
||||||
self.CV.create_text(tx+x*xm, self.ch-ty//2., text=str(x), justify=tk.CENTER, font="Verdana 8")
|
self.CV.create_text(tx+x*xm, self.ch-ty//2., text=str(x)[:4], justify=tk.CENTER, font="Verdana 8")
|
||||||
x = x + 0.2
|
x = x + 0.2
|
||||||
|
|
||||||
y = 0
|
y = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user