played around with different inputs to change the temperature display
[goodfet] / client / GoodFETMCPCANCommunication.py
index 9c60cb0..676d018 100644 (file)
@@ -556,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
@@ -605,13 +605,18 @@ class GoodFETMCPCANCommunication:
             
         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"