ajout timing paquets
This commit is contained in:
parent
25b6ac06ae
commit
625ea6c511
@ -97,7 +97,9 @@ class BlockStackApp(QWidget):
|
|||||||
|
|
||||||
for port, bench_id, serial_number in bench_list:
|
for port, bench_id, serial_number in bench_list:
|
||||||
block_id = f"{bench_id}"
|
block_id = f"{bench_id}"
|
||||||
|
|
||||||
self.worker = UpdateWorker(serial_number, bench_id, port, block_id, self)
|
self.worker = UpdateWorker(serial_number, bench_id, port, block_id, self)
|
||||||
|
|
||||||
self.layout.addWidget(self.worker.block)
|
self.layout.addWidget(self.worker.block)
|
||||||
self.worker.change_color_signal.connect(self.change_button_color)
|
self.worker.change_color_signal.connect(self.change_button_color)
|
||||||
self.worker.update_signal.connect(self.update_block)
|
self.worker.update_signal.connect(self.update_block)
|
||||||
@ -199,9 +201,11 @@ class BlockStackApp(QWidget):
|
|||||||
print(f"Data received: {data}")
|
print(f"Data received: {data}")
|
||||||
|
|
||||||
def update_block(self, is_running, diameter_value, position_value):
|
def update_block(self, is_running, diameter_value, position_value):
|
||||||
|
ts = round(time.time() * 1000)
|
||||||
|
|
||||||
# Update the block with diameter_value and position_value
|
# Update the block with diameter_value and position_value
|
||||||
worker = self.sender()
|
worker = self.sender()
|
||||||
diameter_avg = 2.0000
|
diameter_avg = 0.0000
|
||||||
est_wgh = 0
|
est_wgh = 0
|
||||||
worker.block.dia_label.setText(f"{diameter_value:.3f} ")
|
worker.block.dia_label.setText(f"{diameter_value:.3f} ")
|
||||||
worker.block.len_label.setText(f"{position_value/1000:.3f}")
|
worker.block.len_label.setText(f"{position_value/1000:.3f}")
|
||||||
@ -228,7 +232,7 @@ class BlockStackApp(QWidget):
|
|||||||
worker.block.max_label.setText(f"{worker.diameter_max:.3f} ")
|
worker.block.max_label.setText(f"{worker.diameter_max:.3f} ")
|
||||||
|
|
||||||
# push data to memory for report
|
# push data to memory for report
|
||||||
worker.data_list.append((position_value, diameter_value))
|
worker.data_list.append((ts, position_value, diameter_value))
|
||||||
|
|
||||||
# push data to graph and update it
|
# push data to graph and update it
|
||||||
self.update_graph(worker, diameter_value)
|
self.update_graph(worker, diameter_value)
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class UpdateWorker(QThread):
|
|||||||
endstamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
endstamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
|
||||||
|
|
||||||
outfilename = os.path.join("data", f"{spool}_{startstamp}.fsl")
|
outfilename = os.path.join("data", f"{spool}_{startstamp}.fslp")
|
||||||
|
|
||||||
|
|
||||||
with open(outfilename, "w") as outfile:
|
with open(outfilename, "w") as outfile:
|
||||||
@ -147,8 +147,8 @@ class UpdateWorker(QThread):
|
|||||||
outfile.write(F"#spool: {spool}\n")
|
outfile.write(F"#spool: {spool}\n")
|
||||||
outfile.write(F"#material: {vendor} {material} {batch} {description}\n")
|
outfile.write(F"#material: {vendor} {material} {batch} {description}\n")
|
||||||
|
|
||||||
for position, diameter in self.data_list:
|
for ts, position, diameter in self.data_list:
|
||||||
outfile.write(f"d:{diameter},p:{position}\n")
|
outfile.write(f"t:{ts},d:{diameter},p:{position}\n")
|
||||||
|
|
||||||
outfile.write(F"#end: {endstamp}\n")
|
outfile.write(F"#end: {endstamp}\n")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user