pumpeakkumuliert
This commit is contained in:
parent
3733c95147
commit
59a9763f79
19
gui/main.py
19
gui/main.py
@ -3,7 +3,7 @@ import serial
|
||||
import serial.tools.list_ports
|
||||
from PyQt6.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, QHBoxLayout,
|
||||
QWidget, QLabel, QPushButton, QComboBox, QDoubleSpinBox,
|
||||
QGroupBox, QStatusBar, QMessageBox)
|
||||
QGroupBox, QStatusBar, QMessageBox, QCheckBox)
|
||||
from PyQt6.QtCore import QTimer, Qt
|
||||
from PyQt6.QtGui import QFont
|
||||
|
||||
@ -74,8 +74,13 @@ class PHControllerGUI(QMainWindow):
|
||||
self.pump_off_btn = QPushButton("Pumpe Aus")
|
||||
self.pump_off_btn.clicked.connect(lambda: self.send_pump_command(0))
|
||||
|
||||
# Volume reset option
|
||||
self.reset_volume_checkbox = QCheckBox("Volumen bei Start zurücksetzen")
|
||||
self.reset_volume_checkbox.setChecked(True) # Default: reset volume
|
||||
|
||||
pump_control_layout.addWidget(self.pump_on_btn)
|
||||
pump_control_layout.addWidget(self.pump_off_btn)
|
||||
pump_control_layout.addWidget(self.reset_volume_checkbox)
|
||||
|
||||
# Tube Selection
|
||||
tube_layout = QHBoxLayout()
|
||||
@ -228,6 +233,7 @@ class PHControllerGUI(QMainWindow):
|
||||
self.cal_ph7_btn.setEnabled(enabled)
|
||||
self.auto_dose_btn.setEnabled(enabled)
|
||||
self.volume_spin.setEnabled(enabled)
|
||||
self.reset_volume_checkbox.setEnabled(enabled)
|
||||
|
||||
def send_command(self, command):
|
||||
print(command)
|
||||
@ -275,9 +281,14 @@ class PHControllerGUI(QMainWindow):
|
||||
self.flow_rate_label.setVisible(True)
|
||||
self.total_volume_label.setVisible(True)
|
||||
|
||||
# Reset volume counter and start timing
|
||||
self.total_volume = 0.0
|
||||
self.total_volume_label.setText("Gesamt: 0.0 ml")
|
||||
# Check if volume should be reset or continue accumulating
|
||||
if self.reset_volume_checkbox.isChecked():
|
||||
# Reset volume counter
|
||||
self.total_volume = 0.0
|
||||
self.total_volume_label.setText("Gesamt: 0.0 ml")
|
||||
else:
|
||||
# Continue with existing volume - just update display
|
||||
self.total_volume_label.setText(f"Gesamt: {self.total_volume:.2f} ml")
|
||||
|
||||
self.flow_rate_timer.start(1000) # Request flow rate every second
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user