X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETMCPCANCommunication.py;h=676d018c9bc751818fff12e99d785f48bda88bba;hp=3350aa864f594d4d4e9967a370bcf2884265b85b;hb=d08bfd3c7cdc687fd68ba9025702c262665e52d3;hpb=c6a361d308d1972ca9d371f515b0e7dd287627f5 diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index 3350aa8..676d018c9 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -155,9 +155,11 @@ class GoodFETMCPCANCommunication: packet=self.client.rxpacket(); #add the data to list if the pointer was included - if(data != None): + if(data != None and packet != None): #data.append(self.client.packet2parsedstr(packet)) - data.put(self.client.packet2parsed(packet)) + packetParsed = self.client.packet2parsed(packet) + packetParsed["time"] =time.time() + data.put(packetParsed) if(debug == True): #check packet status MCPstatusReg = self.client.MCPrxstatus(); @@ -554,7 +556,7 @@ class GoodFETMCPCANCommunication: self.spitSetup(freq); spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None) - def spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None): + def spit(self,freq, standardid, repeat,writes, period = None, debug = False, packet = None): #### split SID into different regs @@ -597,19 +599,24 @@ class GoodFETMCPCANCommunication: print "Transmitting packet: " - print self.client.packet2str(packet) + #print self.client.packet2str(packet) self.client.txpacket(packet); if repeat: print "\nNow looping on transmit. " - if duration!= None: - starttime = time.time(); - while((time.time()-starttime < duration)): + if period != None: + for i in range(0,writes): self.client.MCPrts(TXB0=True); - print "MSG printed" + tic = time.time() + time.sleep(period/1000) # pause for period ms before sending again + print time.time()-tic + #starttime = time.time(); + #while((time.time()-starttime < duration)): + # self.client.MCPrts(TXB0=True); + # print "MSG printed" else: - while(1): + for i in range(0,writes): self.client.MCPrts(TXB0=True); print "messages injected"