From 7c72e508d7ea0ccc4e30230f6a5a3f5495d1d3af Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 7 Aug 2025 00:45:32 +0200 Subject: [PATCH] MainCode/adalm1000_logger.py aktualisiert One device working :) D --- MainCode/adalm1000_logger.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/MainCode/adalm1000_logger.py b/MainCode/adalm1000_logger.py index 2fa3d24..b35d172 100644 --- a/MainCode/adalm1000_logger.py +++ b/MainCode/adalm1000_logger.py @@ -2365,11 +2365,12 @@ class BatteryTester(QMainWindow): def auto_scale_axes(self): """Auto-scale plot axes with appropriate padding and strict boundaries""" - if not self.time_data: + if not self.active_device or not self.active_device.time_data: return + dev = self.active_device min_time = 0 - max_time = self.time_data[-1] + max_time = dev.time_data[-1] current_xlim = self.ax.get_xlim() if max_time > current_xlim[1] * 0.95: @@ -2378,17 +2379,17 @@ class BatteryTester(QMainWindow): self.ax2.set_xlim(min_time, new_max) voltage_padding = 0.2 - if self.voltage_data: - min_voltage = max(0, min(self.voltage_data) - voltage_padding) - max_voltage = min(5.0, max(self.voltage_data) + voltage_padding) + if dev.voltage_data: + min_voltage = max(0, min(dev.voltage_data) - voltage_padding) + max_voltage = min(5.0, max(dev.voltage_data) + voltage_padding) current_ylim = self.ax.get_ylim() if (abs(current_ylim[0] - min_voltage) > 0.1 or abs(current_ylim[1] - max_voltage) > 0.1): self.ax.set_ylim(min_voltage, max_voltage) current_padding = 0.05 - if self.current_data: - min_current = max(-0.25, min(self.current_data) - current_padding) - max_current = min(0.25, max(self.current_data) + current_padding) + if dev.current_data: + min_current = max(-0.25, min(dev.current_data) - current_padding) + max_current = min(0.25, max(dev.current_data) + current_padding) current_ylim2 = self.ax2.get_ylim() if (abs(current_ylim2[0] - min_current) > 0.02 or abs(current_ylim2[1] - max_current) > 0.02): self.ax2.set_ylim(min_current, max_current)