From a79ad534570c57d910655bcdbc2325c3918e8018 Mon Sep 17 00:00:00 2001 From: shrlnm Date: Sun, 21 Aug 2022 10:19:04 +0300 Subject: [PATCH] fix mod_ecu.py --- README.md | 9 ++++--- pyren3/mod_ecu.py | 64 +++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 2906b0b..a4f96eb 100644 --- a/README.md +++ b/README.md @@ -137,16 +137,17 @@ https://www.youtube.com/watch?v=DazsvlnLCoA * **mod_optfile.py** - for exploring CLIP database * **mod_term.py** - simple terminal * **mod_ecu.py** - shows list of all parameters, commands and DTCs. Build "PID" CSV file for "Torque PRO" +* **acf.py** - build default dump file and autoconfiguration macro (require BVMEXTRACTION folder and *.acf db) # Installation ## Dependencies -* **Python 3.7.xx** +* **Python 3.7+** * **ELM327** adapter with FlowControl support (original one or chinese v1.5) * **ELM327-USB** - preferred for Windows, Linux and MacOS - * **ELM327-BT** - not compatible with Android 7.0 and above, use ELM327-WiFi -* **CLIP database** required for CLIP mode, not included (not included, you must own it) -* **DDT2000 database** required for DDT mode, not included (not included, you must own it) + * **ELM327-BT** - supports only 38400 bit/sec serial communication speed +* **CLIP database** required for CLIP mode (not included you must own it) +* **DDT2000 database** required for DDT mode (not included, you must own it) ## Installation on Windows diff --git a/pyren3/mod_ecu.py b/pyren3/mod_ecu.py index 9eae40c..05eb972 100755 --- a/pyren3/mod_ecu.py +++ b/pyren3/mod_ecu.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_utils import * from mod_ecu_screen import * @@ -1040,7 +1040,7 @@ class ECU: langmap = self.getLanguageMap() ddt = DDT(self.elm, self.ecudata, langmap) del(ddt) - gc.collect () + #gc.collect () continue fav_sc = self.screens[int(choice[1]) - 1] @@ -1429,7 +1429,7 @@ def main(): c_unit = Parameters[i].unit line = '"PR_%s","%s","%s","%s","%s","%s","%s","%s"\n'%(c_name,c_short,c_pid,c_equ,c_min,c_max,c_unit,ddd) - cf.write( line.encode('utf-8') ) + cf.write( line ) memIt = [] for i in sorted(States.keys()): @@ -1464,7 +1464,7 @@ def main(): c_unit = '' line = '"ST_%s","%s","%s","%s","%s","%s","%s","%s"\n'%(c_name,c_short,c_pid,c_equ,c_min,c_max,c_unit,ddd) - cf.write( line.encode('utf-8') ) + cf.write( line ) cf.close() @@ -1500,37 +1500,37 @@ def main(): profilename = '/sdcard/.torque/vehicles/'+str(int(time.time()))+'.tdv' prn = open( profilename, "w") - prn.write( '#This is an ECU profile generated by pyren\n'.encode('utf-8') ) - prn.write( 'fuelType=0\n'.encode('utf-8') ) - prn.write( 'obdAdjustNew=1.0\n'.encode('utf-8') ) - prn.write( 'lastMPG=0.0\n'.encode('utf-8') ) - prn.write( 'tankCapacity=295.5\n'.encode('utf-8') ) - prn.write( 'volumetricEfficiency=85.0\n'.encode('utf-8') ) - prn.write( 'weight=1400.0\n'.encode('utf-8') ) - prn.write( 'odoMeter=0.0\n'.encode('utf-8') ) - prn.write( 'adapterName=OBDII [00\:00\:00\:00\:00\:0]\n'.encode('utf-8') ) - prn.write( 'adapter=00\:00\:00\:00\:00\:00\n'.encode('utf-8') ) - prn.write( 'boostAdjust=0.0\n'.encode('utf-8') ) - prn.write( 'mpgAdjust=1.0\n'.encode('utf-8') ) - prn.write( 'fuelCost=0.18000000715255737\n'.encode('utf-8') ) - prn.write( 'ownProfile=false\n'.encode('utf-8') ) - prn.write( 'displacement=1.6\n'.encode('utf-8') ) - prn.write( 'tankUsed=147.75\n'.encode('utf-8') ) - prn.write( 'lastMPGCount=0\n'.encode('utf-8') ) - prn.write( 'maxRpm=7000\n'.encode('utf-8') ) - prn.write( 'fuelDistance=0.0\n'.encode('utf-8') ) - prn.write( 'fuelUsed=0.0\n'.encode('utf-8') ) - prn.write( 'alternateHeader=true\n'.encode('utf-8') ) - prn.write( ('name=PR_'+ecuid+'\n').encode('utf-8') ) + prn.write( '#This is an ECU profile generated by pyren\n' ) + prn.write( 'fuelType=0\n' ) + prn.write( 'obdAdjustNew=1.0\n' ) + prn.write( 'lastMPG=0.0\n' ) + prn.write( 'tankCapacity=295.5\n' ) + prn.write( 'volumetricEfficiency=85.0\n' ) + prn.write( 'weight=1400.0\n' ) + prn.write( 'odoMeter=0.0\n' ) + prn.write( 'adapterName=OBDII [00\:00\:00\:00\:00\:0]\n' ) + prn.write( 'adapter=00\:00\:00\:00\:00\:00\n' ) + prn.write( 'boostAdjust=0.0\n' ) + prn.write( 'mpgAdjust=1.0\n' ) + prn.write( 'fuelCost=0.18000000715255737\n' ) + prn.write( 'ownProfile=false\n' ) + prn.write( 'displacement=1.6\n' ) + prn.write( 'tankUsed=147.75\n' ) + prn.write( 'lastMPGCount=0\n' ) + prn.write( 'maxRpm=7000\n' ) + prn.write( 'fuelDistance=0.0\n' ) + prn.write( 'fuelUsed=0.0\n' ) + prn.write( 'alternateHeader=true\n' ) + prn.write( ('name=PR_'+ecuid+'\n') ) if len(candst)>1: - prn.write( ('customInit='+can500init.replace('\\','\\\\')+'\n').encode('utf-8') ) - prn.write( 'preferredProtocol=7\n'.encode('utf-8') ) + prn.write( ('customInit='+can500init.replace('\\','\\\\')+'\n') ) + prn.write( 'preferredProtocol=7\n' ) elif len(fastinit)>1: - prn.write( ('customInit='+fast10init.replace('\\','\\\\')+'\n').encode('utf-8') ) - prn.write( 'preferredProtocol=6\n'.encode('utf-8') ) + prn.write( ('customInit='+fast10init.replace('\\','\\\\')+'\n') ) + prn.write( 'preferredProtocol=6\n' ) else: - prn.write( ('customInit='+slow05init.replace('\\','\\\\')+'\n').encode('utf-8') ) - prn.write( 'preferredProtocol=5\n'.encode('utf-8') ) + prn.write( ('customInit='+slow05init.replace('\\','\\\\')+'\n') ) + prn.write( 'preferredProtocol=5\n' ) prn.close() print()