def read_serial_data(self): """ Called periodically by the update timer to read data from the serial port. """ qdata = list(get_all_from_queue(self.data_q)) if len(qdata) > 0: # print qdata data = dict(timestamp=qdata[-1][1], temperature=int(qdata[-1][0])) self.livefeed.add_data(data)
def on_timer(self, *args): data = list(get_all_from_queue(self.data_q)) # (timestamp, [x0, x1, x2, etc]) if (len(data) == 0): return for row in data: for idx in xrange(min(len(row[1]), len(self.players))): self.players[idx].adsr(row[1][idx])
def read_serial_data(self): """ Called periodically by the update timer to read data from the serial port. """ qdata = list(get_all_from_queue(self.data_q)) if len(qdata) > 0: data = dict(timestamp=qdata[-1][1], temperature=ord(qdata[-1][0])) self.livefeed.add_data(data)
def on_timer(self,*args): data = list(get_all_from_queue(self.data_q)) if (len(data)==0): return for idx in xrange(self.modules.count()): plug = self.modules.item(idx) if plug.checkState(): plug.ob.new_data(data)
def read_serial_data(self): """ Called periodically by the update timer to read data from the serial port. """ qdata = list(get_all_from_queue(self.data_q)) if len(qdata) > 0: data = self.data+''.join(qdata) while data.find("Id: ")!=-1: msgStart = data.find("Id: ") msgEnd = data.find("\n",msgStart) if msgEnd == -1: break packet = data[msgStart:msgEnd-1] # print "msg: [%s]" % packet msgId = int(packet[4:8],16) # print "msgId: %d [%x]" % (msgId, msgId) msgData = map(lambda x: int(x,16) ,packet[16:].split(" ")) # print "data: ", msgData self.update_data(msgId, msgData) data = data[msgEnd:] self.data = data
def read_serial_data(self): """ Called periodically by the update timer to read data from the serial port. """ qdata = list(get_all_from_queue(self.data_q)) if len(qdata) > 0: # At this point qdata object is a list type count = 0 # Updates the text box with the incoming values # Clears the text box every 4096 values so that # Memory does not fill up with scrolling text for elem in list(qdata): self.editbox.append(qdata[count][0]) if self.editbox.document().blockCount() == 4096: self.editbox.clear() data = dict(timestamp=qdata[count][1],temperature=int(qdata[count][0])) self.livefeed.add_data(data) if self.logger_active: self.reading_num = self.reading_num + 1 #Uncomment for stamps # #utimestamp = time.time() #A unix style timestamp for the log #self.save_data_stamps(self.reading_num,int(qdata[count][0]),qdata[count][1],utimestamp) if self.today != str(datetime.date.today()): self.file.close() self.log(); self.reading_num = self.reading_num + 1 self.save_data(int(qdata[count][0])) count=count+1