diff --git a/pyren/mod_ecu_mnemonic.py b/pyren/mod_ecu_mnemonic.py index c2c2c52..d3649ee 100755 --- a/pyren/mod_ecu_mnemonic.py +++ b/pyren/mod_ecu_mnemonic.py @@ -65,7 +65,10 @@ def get_mnemonic( m, se, elm, raw = 0 ): hexval = hexval.replace(" ","") if raw: - return hexval + if resp.startswith(m.positive): + return hexval + else: + return 'ERROR' #shift and mask val = (int(hexval,16)>>rshift)&(2**bits-1) diff --git a/pyren/scen_ecri_paraminj1.py b/pyren/scen_ecri_paraminj1.py index 497dc31..a4cd958 100644 --- a/pyren/scen_ecri_paraminj1.py +++ b/pyren/scen_ecri_paraminj1.py @@ -375,10 +375,23 @@ def run( elm, ecu, command, data ): for paramkey in params.keys(): if params[paramkey] == "Mileage": + mnemonics = ecu.get_ref_id(identsList[paramkey]).mnemolist[0] identValue = ecu.get_id(identsList[paramkey], 1) - params[paramkey] = "{0:0{1}X}".format(mileage,len(identValue)) + hexval = "{0:0{1}X}".format(mileage,len(identValue)) + if ecu.Mnemonics[mnemonics].littleEndian == '1': + a = hexval + b = '' + if not len(a) % 2: + for i in range(0,len(a),2): + b = a[i:i+2]+b + hexval = b + params[paramkey] = hexval command, paramToSend = getValuesFromEcu(params) + + if "ERROR" in paramToSend: + raw_input("Data downloading went wrong. Aborting.") + return clearScreen() @@ -438,6 +451,10 @@ def run( elm, ecu, command, data ): params.pop("IdentToBeDisplayed") command, paramToSend = getValuesFromEcu(params) + + if "ERROR" in paramToSend: + raw_input("Data downloading went wrong. Aborting.") + return clearScreen() @@ -483,6 +500,10 @@ def run( elm, ecu, command, data ): command, paramToSend = getValuesFromEcu(params) + if "ERROR" in paramToSend: + raw_input("Data downloading went wrong. Aborting.") + return + clearScreen() print