MainCode/adalm1000_logger.py aktualisiert
Working (D)
This commit is contained in:
parent
418885aca8
commit
20fe83a319
@ -315,51 +315,55 @@ class BatteryTester(QMainWindow):
|
||||
|
||||
# Measurement values
|
||||
measurement_labels = [
|
||||
("Voltage (V)", "V"),
|
||||
("Current (A)", "A"),
|
||||
("Test Phase", ""),
|
||||
("Elapsed Time", "s"),
|
||||
("Discharge Capacity", "Ah"),
|
||||
("Charge Capacity", "Ah"),
|
||||
("Coulomb Eff.", "%"),
|
||||
("Cycle Count", ""),
|
||||
("Voltage", "V"), ("Current", "A"), ("Test Phase", ""),
|
||||
("Elapsed Time", "s"), ("Discharge Capacity", "Ah"), ("Charge Capacity", "Ah"),
|
||||
("Coulomb Eff.", "%"), ("Cycle Count", ""), ("Battery Temp", "°C"),
|
||||
("Internal R", "Ω"), ("Power", "W"), ("Energy", "Wh")
|
||||
]
|
||||
|
||||
self.value_labels = {}
|
||||
# 4 Zeilen × 3 Spalten Anordnung
|
||||
for i, (label, unit) in enumerate(measurement_labels):
|
||||
row = i // 2
|
||||
col = (i % 2) * 2
|
||||
row = i // 3 # 0-3 (4 Zeilen)
|
||||
col = (i % 3) * 3 # 0, 3, 6 (3 Spalten mit je 3 Widgets)
|
||||
|
||||
# Label für den Messwertnamen
|
||||
lbl = QLabel(f"{label}:")
|
||||
lbl.setStyleSheet(f"color: {self.fg_color};")
|
||||
lbl.setStyleSheet(f"color: {self.fg_color}; font-size: 11px;")
|
||||
display_layout.addWidget(lbl, row, col)
|
||||
|
||||
# Label für den Messwert
|
||||
value_lbl = QLabel("0.000")
|
||||
value_lbl.setStyleSheet(f"color: {self.fg_color}; font-weight: bold;")
|
||||
value_lbl.setStyleSheet(f"""
|
||||
color: {self.fg_color};
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
min-width: 60px;
|
||||
""")
|
||||
display_layout.addWidget(value_lbl, row, col + 1)
|
||||
|
||||
# Einheit falls vorhanden
|
||||
if unit:
|
||||
unit_lbl = QLabel(unit)
|
||||
unit_lbl.setStyleSheet(f"color: {self.fg_color};")
|
||||
unit_lbl.setStyleSheet(f"color: {self.fg_color}; font-size: 11px;")
|
||||
display_layout.addWidget(unit_lbl, row, col + 2)
|
||||
|
||||
# Store references to important labels
|
||||
if i == 0:
|
||||
self.voltage_label = value_lbl
|
||||
elif i == 1:
|
||||
self.current_label = value_lbl
|
||||
elif i == 2:
|
||||
self.phase_label = value_lbl
|
||||
elif i == 3:
|
||||
self.time_label = value_lbl
|
||||
elif i == 4:
|
||||
self.capacity_label = value_lbl
|
||||
elif i == 5:
|
||||
self.charge_capacity_label = value_lbl
|
||||
elif i == 6:
|
||||
self.efficiency_label = value_lbl
|
||||
elif i == 7:
|
||||
self.cycle_label = value_lbl
|
||||
|
||||
# Spaltenabstände anpassen
|
||||
for i in range(9): # 3 Spalten × 3 Widgets
|
||||
display_layout.setColumnStretch(i, 1 if i % 3 == 1 else 0) # Nur Wert-Spalten dehnen
|
||||
|
||||
# Referenzen aktualisieren
|
||||
self.voltage_label = display_layout.itemAtPosition(0, 1).widget()
|
||||
self.current_label = display_layout.itemAtPosition(0, 4).widget()
|
||||
self.phase_label = display_layout.itemAtPosition(0, 7).widget()
|
||||
self.time_label = display_layout.itemAtPosition(1, 1).widget()
|
||||
self.capacity_label = display_layout.itemAtPosition(1, 4).widget()
|
||||
self.charge_capacity_label = display_layout.itemAtPosition(1, 7).widget()
|
||||
self.efficiency_label = display_layout.itemAtPosition(2, 1).widget()
|
||||
self.cycle_label = display_layout.itemAtPosition(2, 4).widget()
|
||||
self.temp_label = display_layout.itemAtPosition(2, 7).widget()
|
||||
self.resistance_label = display_layout.itemAtPosition(3, 1).widget()
|
||||
self.power_label = display_layout.itemAtPosition(3, 4).widget()
|
||||
self.energy_label = display_layout.itemAtPosition(3, 7).widget()
|
||||
|
||||
self.main_layout.addWidget(display_frame)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user