add calculation time debug message for simulator

This commit is contained in:
Fisch 2018-01-13 13:11:20 +01:00
parent c065795134
commit fee8f342eb
1 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class FlipdotSim():
self.udpHostSocket.bind(("", self.udpPort))
self.timesincelastpacket=time.time()
self.timelastcalculation=0
def run(self):
self.RunServer()
@ -49,7 +50,7 @@ class FlipdotSim():
imageArray = ImageArrayAdapter().convertPacketToImageArray(rawData)
if DEBUG:
print("Received Data. Time since last message: "+str( round( time.time()-self.timesincelastpacket,2))+"s ("+str( round( (1/ (time.time()-self.timesincelastpacket) ) ,2) ) +" FPS)")
print("Received Data. Time since last message: "+str( round( time.time()-self.timesincelastpacket,2))+"s ("+str( round( (1/ (time.time()-self.timesincelastpacket) ) ,2) ) +" FPS), last calctime="+str(round( (self.timelastcalculation) ,2)))
self.timesincelastpacket=time.time()
_bitsneeded=self.imageSize[0]*self.imageSize[1]*self.bitsperpixel
if len(imageArray) < _bitsneeded:
@ -67,6 +68,8 @@ class FlipdotSim():
self.flipdotMatrixSimulatorWidget.show(imageArray) #send to simulator display
self.timelastcalculation=time.time()-self.timesincelastpacket #calculate time it took for calculation and drawing
finally:
self.udpHostSocket.close()