This commit is contained in:
Jonathan Roth 2025-04-29 15:56:50 +02:00
parent 2d7c3c4995
commit 84f6e0a829
2 changed files with 18 additions and 17 deletions

View File

@ -217,7 +217,7 @@ class BlockStackApp(QWidget):
worker.data_list.append((ts, dial_number, position_value, diameter_value))
# push data to graph and update it
self.update_graph(worker, dial_number, diameter_value)
self.update_graph(worker, dial_number, diameter_value, position_value)
# calculate and display average diameter
if is_running:
@ -230,7 +230,7 @@ class BlockStackApp(QWidget):
worker.block.wht_label.setText(f"{est_wgh/1000:.3f} ")
def update_graph(self, worker, dial_number,diameter_value):
def update_graph(self, worker, dial_number,diameter_value,position_value):
# def update_graph(self, worker, dial_number, diameter_value, diameter_value2, diameter_value3):
@ -255,15 +255,15 @@ class BlockStackApp(QWidget):
# Append new data points
match dial_number:
case 0:
x_data1.append(len(x_data1))
x_data1.append(position_value)
y_data1.append(diameter_value)
worker.diameter_value1 = diameter_value
case 1:
x_data2.append(len(x_data2))
x_data2.append(position_value)
y_data2.append(diameter_value)
worker.diameter_value2 = diameter_value
case 2:
x_data3.append(len(x_data3))
x_data3.append(position_value)
y_data3.append(diameter_value)
worker.diameter_value3 = diameter_value
@ -292,19 +292,18 @@ class BlockStackApp(QWidget):
diameter_avg = sum(all_y_data) / len(all_y_data) if all_y_data else 0
worker.block.avg_label.setText(f"{diameter_avg:.4f}")
# worker running, trim number of values to keep graph aligned
else:
nvalues = min(len(y_data1), len(y_data2), len(y_data3)) + 1
# # worker running, trim number of values to keep graph aligned
# else:
# nvalues = min(len(y_data1), len(y_data2), len(y_data3)) + 1
# if len(y_data1) > 200:
y_data1 = y_data1[-nvalues:]
y_data2 = y_data2[-nvalues:]
y_data3 = y_data3[-nvalues:]
# y_data1 = y_data1[-nvalues:]
# y_data2 = y_data2[-nvalues:]
# y_data3 = y_data3[-nvalues:]
# Update x-axis values to reflect the rolling window
x_data1 = list(range(len(y_data1)))
x_data2 = list(range(len(y_data2)))
x_data3 = list(range(len(y_data3)))
# # Update x-axis values to reflect the rolling window
# x_data1 = list(range(len(y_data1)))
# x_data2 = list(range(len(y_data2)))
# x_data3 = list(range(len(y_data3)))
diameter_calc = worker.diameter_value1

View File

@ -102,7 +102,9 @@ class UpdateWorker(QThread):
print(f"position: {self.position_value} diameter: {self.diameter_value}")
if (self.position_value > 200) and ((1.65 < self.diameter_value) and (self.diameter_value < 1.85)) or ((2.70 < self.diameter_value) and (self.diameter_value < 2.95)):
if (self.position_value > 200) and \
((1.60 < self.diameter_min) and (self.diameter_max < 1.90)) or \
((2.60 < self.diameter_min) and (self.diameter_max < 2.95)):
self.prepare_ok = True
print(f"preparation VALID")