MainCode/adalm1000_logger.py aktualisiert
Timing angepasst (ChatGPT)
This commit is contained in:
parent
a9a871bff5
commit
516e2a44b2
@ -506,8 +506,10 @@ class BatteryTester:
|
||||
time_elapsed = time.time() - self.last_update_time
|
||||
|
||||
# Update charge capacity
|
||||
self.charge_capacity.set(self.charge_capacity.get() + measured_current * time_elapsed / 3600)
|
||||
self.last_update_time = time.time()
|
||||
now = time.time()
|
||||
delta_t = now - self.last_update_time
|
||||
self.last_update_time = now
|
||||
self.charge_capacity.set(self.charge_capacity.get() + measured_current * delta_t / 3600)
|
||||
|
||||
self.status_var.set(
|
||||
f"Charging: {current_voltage:.3f}V / {target_voltage}V | "
|
||||
@ -562,8 +564,10 @@ class BatteryTester:
|
||||
current_current = abs(self.current_data[-1])
|
||||
|
||||
# Calculate discharged capacity
|
||||
self.capacity_ah.set(self.capacity_ah.get() + current_current * (time.time() - self.last_update_time) / 3600)
|
||||
self.last_update_time = time.time()
|
||||
now = time.time()
|
||||
delta_t = now - self.last_update_time
|
||||
self.last_update_time = now
|
||||
self.capacity_ah.set(self.capacity_ah.get() + measured_current * delta_t / 3600)
|
||||
|
||||
self.status_var.set(
|
||||
f"Discharging: {current_voltage:.3f}V / {self.discharge_cutoff.get()}V | "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user