Skip to content

Commit 354e93e

Browse files
committed
Add comment, clean up
1 parent 2fd0337 commit 354e93e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ def _update_log_direction(
504504
if self._logs is None:
505505
return
506506

507-
508507
prev_address, prev_slot = calc_log_address(address, slot, -1)
509508
if self._log_exists(prev_address, prev_slot):
510509
timestamp_2 = self._logs[prev_address][prev_slot].timestamp
@@ -525,6 +524,8 @@ def _update_log_direction(
525524
prev_prev_address, prev_prev_slot = calc_log_address(address, slot, -2)
526525
if self._log_exists(prev_prev_address, prev_prev_slot):
527526
timestamp_3 = self._logs[prev_prev_address][prev_prev_slot].timestamp
527+
# _log_production is True when 2 out of 3 consecutive slots have
528+
# the same timestamp, otherwise it is False
528529
self._log_production = (
529530
timestamp_2 == timestamp and timestamp_3 != timestamp
530531
) or (timestamp_2 == timestamp_3 and timestamp_2 != timestamp)
@@ -538,7 +539,6 @@ def _update_log_direction(
538539
if self._logs[next_address][next_slot].is_consumption:
539540
self._logs[next_address][next_slot].is_consumption = False
540541
self._reset_log_references()
541-
self._log_production = True
542542
elif self._log_production:
543543
self._logs[address][slot].is_consumption = False
544544
self._logs[next_address][next_slot].is_consumption = True

0 commit comments

Comments
 (0)