From e69fa827ffcc6d978d9cf6b4ce967327e276d224 Mon Sep 17 00:00:00 2001 From: chrishoder Date: Wed, 13 Feb 2013 03:27:42 +0000 Subject: [PATCH 1/1] minor bug fix on parsing experiments data git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1483 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/FordExperiments.py | 19 +++++++++++++++++++ client/GoodFETMCPCAN.py | 2 +- client/GoodFETMCPCANCommunication.py | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/client/FordExperiments.py b/client/FordExperiments.py index 5853645..326cf2e 100644 --- a/client/FordExperiments.py +++ b/client/FordExperiments.py @@ -142,6 +142,25 @@ class FordExperiments(GoodFETMCPCANCommunication): #recieveTime = time.time() return packetParsed + + def cycle4packets1279(self): + self.client.serInit() + self.spitSetup(500) + # filter on 1279 + self.addFilter([1279, 1279, 1279, 1279, 1279, 1279], verbose = False) + packetParsed = self.getBackground(1279) + packet = [] + if (packetParsed[db0] == 16): + # if it's the first of the four packets, replace the value in db7 with 83 + packetParsed[db7] = 83 + # transmit new packet + self.client.txpacket(packetParsed) + else: + # otherwise, leave it alone + # transmit same pakcet we read in + self.client.txpacket(packetParsed) + # print the packet we are transmitting + print packetParsed def oscillateTemperature(self,time): diff --git a/client/GoodFETMCPCAN.py b/client/GoodFETMCPCAN.py index 0232b28..46c8ec4 100644 --- a/client/GoodFETMCPCAN.py +++ b/client/GoodFETMCPCAN.py @@ -329,7 +329,7 @@ class GoodFETMCPCAN(GoodFETSPI): def packet2parsedstr(self,data): packet = self.packet2parsed(data) - msg = "sID: %04d" %sId + msg = "sID: %04d" %packet['sId'] if( packetParsed.get('eID')): msg += " eID: %d" %packetParsed.get('eID') msg += " rtr: %d"%packetParsed['rtr'] diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index 6aee2ef..6af64ff 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -237,8 +237,8 @@ class GoodFETMCPCANCommunication: for byte in packet: row.append("%02x"%ord(byte)); dataWriter.writerow(row); - - outfile.close() + if(writeToFile == True): + outfile.close() print "Listened for %d seconds, captured %d packets." %(duration,packetcount); return packetcount -- 2.20.1