MainCode/adalm1000_logger.py aktualisiert
Alles sollte funktionieren. (D)
This commit is contained in:
parent
d368cec550
commit
401f19d237
@ -218,11 +218,16 @@ class TestSequenceWorker(QObject):
|
||||
def run(self):
|
||||
"""Main test sequence loop"""
|
||||
try:
|
||||
while self._running and (self.continuous_mode or self.parent.cycle_count == 0):
|
||||
# Reset stop request at start of each cycle
|
||||
first_cycle = True # Ensure at least one cycle runs
|
||||
|
||||
# Modified while condition to also check parent's continuous_mode state
|
||||
while (self._running and
|
||||
(self.parent.continuous_mode_check.isChecked() or first_cycle)):
|
||||
self.parent.request_stop = False
|
||||
self.parent.cycle_count += 1
|
||||
first_cycle = False # Only True for the first cycle
|
||||
|
||||
# Existing test phases...
|
||||
# 1. Charge phase (constant current)
|
||||
self.charge_phase()
|
||||
if not self._running or self.parent.request_stop:
|
||||
@ -244,7 +249,9 @@ class TestSequenceWorker(QObject):
|
||||
|
||||
# Calculate Coulomb efficiency if not stopping
|
||||
if not self.parent.request_stop and self.parent.charge_capacity > 0:
|
||||
self.parent.coulomb_efficiency = (self.parent.capacity_ah / self.parent.charge_capacity) * 100
|
||||
self.parent.coulomb_efficiency = (
|
||||
self.parent.capacity_ah / self.parent.charge_capacity
|
||||
) * 100
|
||||
|
||||
# Test completed
|
||||
self.test_completed.emit()
|
||||
@ -513,6 +520,7 @@ class BatteryTester(QMainWindow):
|
||||
self.continuous_mode_check.setChecked(True)
|
||||
self.continuous_mode_check.setStyleSheet(f"color: {self.fg_color};")
|
||||
button_layout.addWidget(self.continuous_mode_check)
|
||||
self.continuous_mode_check.stateChanged.connect(self.handle_continuous_mode_change)
|
||||
|
||||
controls_layout.addWidget(button_frame)
|
||||
self.main_layout.addWidget(controls_frame)
|
||||
@ -542,6 +550,14 @@ class BatteryTester(QMainWindow):
|
||||
}}
|
||||
""")
|
||||
|
||||
def handle_continuous_mode_change(self, state):
|
||||
"""Handle changes to continuous mode checkbox during operation"""
|
||||
if not state and self.test_running: # If unchecked during test
|
||||
self.status_bar.showMessage("Continuous mode disabled - will complete current cycle")
|
||||
# Optional visual feedback
|
||||
self.continuous_mode_check.setStyleSheet(f"color: {self.warning_color};")
|
||||
QTimer.singleShot(2000, lambda: self.continuous_mode_check.setStyleSheet(f"color: {self.fg_color};"))
|
||||
|
||||
def setup_plot(self):
|
||||
"""Configure the matplotlib plot"""
|
||||
self.fig = Figure(figsize=(8, 5), dpi=100, facecolor=self.bg_color)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user