MainCode/adalm1000_logger.py aktualisiert

no live data 
D
This commit is contained in:
Jan 2025-08-07 17:28:57 +02:00
parent 70a4b130d6
commit acdc6bb8ee

View File

@ -631,7 +631,8 @@ class BatteryTester(QMainWindow):
# Initialize UI and device
self.setup_ui()
self.init_device()
self.current_mode = "Live Monitoring" # Default mode
self.current_mode = "Live Monitoring"
self.change_mode(self.current_mode)
# Set window properties
self.setWindowTitle("ADALM1000 - Battery Tester (Multi-Mode)")
@ -979,7 +980,7 @@ class BatteryTester(QMainWindow):
all_success = True
for serial, device in self.devices.items():
if not device.is_recording:
if not self._start_device_recording(device):
if not self.start_live_monitoring(device):
all_success = False
print(f"Failed to start recording for device {serial}")
@ -994,7 +995,7 @@ class BatteryTester(QMainWindow):
else:
# Stop recording for all devices
for device in self.devices.values():
self._stop_device_recording(device)
self.finalize_device_log_file(device) # Changed from _stop_device_recording
self.record_button.setText("● Start Recording")
self.record_button.setStyleSheet(f"background-color: {self.success_color};")
@ -1034,19 +1035,22 @@ class BatteryTester(QMainWindow):
# Record button only for live monitoring
self.record_button.setVisible(mode_name == "Live Monitoring")
# Set button text based on mode
# Set button text based on mode and make sure it's visible for test modes
if mode_name == "Cycle Test":
self.toggle_button.setText("START CYCLE TEST")
self.toggle_button.show()
elif mode_name == "Discharge Test":
self.toggle_button.setText("START DISCHARGE")
self.toggle_button.show()
elif mode_name == "Charge Test":
self.toggle_button.setText("START CHARGE")
self.toggle_button.show()
elif mode_name == "Live Monitoring":
self.toggle_button.setText("START")
self.toggle_button.hide()
self.toggle_button.hide() # Only hide for Live Monitoring
# Reset button state
self.toggle_button.setChecked(False)
self.toggle_button.setEnabled(True)
# Reset measurement state and zero the time
if self.active_device:
@ -1109,7 +1113,7 @@ class BatteryTester(QMainWindow):
self.status_bar.showMessage("Live recording started")
# Ensure monitoring is running
if not self.test_running:
self.start_live_monitoring()
self.start_live_monitoring(self.active_device)
else:
self.record_button.setChecked(False)
self.current_cycle_file = None
@ -1612,8 +1616,8 @@ class BatteryTester(QMainWindow):
self.stop_test()
return
# Create log file
if not self._start_device_recording(self.active_device):
# Create log file - using start_live_monitoring instead of _start_device_recording
if not self.start_live_monitoring(self.active_device):
self.stop_test()
return
@ -1705,7 +1709,8 @@ class BatteryTester(QMainWindow):
self.stop_test()
elif self.current_mode == "Live Monitoring":
self.start_live_monitoring()
# Ensure we pass the device parameter
self.start_live_monitoring(self.active_device)
def start_cycle_test(self):
"""Start the battery cycle test"""
@ -2272,7 +2277,6 @@ class BatteryTester(QMainWindow):
super().closeEvent(event)
def reset_test_data(self):
"""Completely reset all test data"""
if not self.active_device:
return
@ -2281,6 +2285,8 @@ class BatteryTester(QMainWindow):
dev.time_data.clear()
dev.voltage_data.clear()
dev.current_data.clear()
# Display-Daten ebenfalls zurücksetzen
dev.display_time_data.clear()
dev.display_voltage_data.clear()
dev.display_current_data.clear()