Skip to content

Commit 2865da0

Browse files
committed
Revert "Correct corrected_pulses to 0 when negative"
This reverts commit 14c7c3d.
1 parent 55d35da commit 2865da0

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,23 +1039,20 @@ def _calc_watts(self, pulses: int, seconds: int, nano_offset: int) -> float | No
10391039
negative = True
10401040
pulses_per_s = abs(pulses_per_s)
10411041

1042-
corrected_pulses = max(
1043-
0,
1044-
seconds * (
1042+
corrected_pulses = seconds * (
1043+
(
10451044
(
1046-
(
1047-
((pulses_per_s + self._calibration.off_noise) ** 2)
1048-
* self._calibration.gain_b
1049-
)
1050-
+ (
1051-
(pulses_per_s + self._calibration.off_noise)
1052-
* self._calibration.gain_a
1053-
)
1045+
((pulses_per_s + self._calibration.off_noise) ** 2)
1046+
* self._calibration.gain_b
1047+
)
1048+
+ (
1049+
(pulses_per_s + self._calibration.off_noise)
1050+
* self._calibration.gain_a
10541051
)
1055-
+ self._calibration.off_tot
10561052
)
1053+
+ self._calibration.off_tot
10571054
)
1058-
if negative and corrected_pulses != 0:
1055+
if negative:
10591056
corrected_pulses = -corrected_pulses
10601057

10611058
return corrected_pulses / PULSES_PER_KW_SECOND / seconds * (1000)

0 commit comments

Comments
 (0)