MainCode/adalm1000_logger.py aktualisiert
One device working :) D
This commit is contained in:
parent
d3d8ad2c5d
commit
7c72e508d7
@ -2365,11 +2365,12 @@ class BatteryTester(QMainWindow):
|
|||||||
|
|
||||||
def auto_scale_axes(self):
|
def auto_scale_axes(self):
|
||||||
"""Auto-scale plot axes with appropriate padding and strict boundaries"""
|
"""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
|
return
|
||||||
|
|
||||||
|
dev = self.active_device
|
||||||
min_time = 0
|
min_time = 0
|
||||||
max_time = self.time_data[-1]
|
max_time = dev.time_data[-1]
|
||||||
current_xlim = self.ax.get_xlim()
|
current_xlim = self.ax.get_xlim()
|
||||||
|
|
||||||
if max_time > current_xlim[1] * 0.95:
|
if max_time > current_xlim[1] * 0.95:
|
||||||
@ -2378,17 +2379,17 @@ class BatteryTester(QMainWindow):
|
|||||||
self.ax2.set_xlim(min_time, new_max)
|
self.ax2.set_xlim(min_time, new_max)
|
||||||
|
|
||||||
voltage_padding = 0.2
|
voltage_padding = 0.2
|
||||||
if self.voltage_data:
|
if dev.voltage_data:
|
||||||
min_voltage = max(0, min(self.voltage_data) - voltage_padding)
|
min_voltage = max(0, min(dev.voltage_data) - voltage_padding)
|
||||||
max_voltage = min(5.0, max(self.voltage_data) + voltage_padding)
|
max_voltage = min(5.0, max(dev.voltage_data) + voltage_padding)
|
||||||
current_ylim = self.ax.get_ylim()
|
current_ylim = self.ax.get_ylim()
|
||||||
if (abs(current_ylim[0] - min_voltage) > 0.1 or abs(current_ylim[1] - max_voltage) > 0.1):
|
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)
|
self.ax.set_ylim(min_voltage, max_voltage)
|
||||||
|
|
||||||
current_padding = 0.05
|
current_padding = 0.05
|
||||||
if self.current_data:
|
if dev.current_data:
|
||||||
min_current = max(-0.25, min(self.current_data) - current_padding)
|
min_current = max(-0.25, min(dev.current_data) - current_padding)
|
||||||
max_current = min(0.25, max(self.current_data) + current_padding)
|
max_current = min(0.25, max(dev.current_data) + current_padding)
|
||||||
current_ylim2 = self.ax2.get_ylim()
|
current_ylim2 = self.ax2.get_ylim()
|
||||||
if (abs(current_ylim2[0] - min_current) > 0.02 or abs(current_ylim2[1] - max_current) > 0.02):
|
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)
|
self.ax2.set_ylim(min_current, max_current)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user