Skip to content

Commit eca8cad

Browse files
authored
Merge pull request #298 from NordicSemiconductor/fix/negative-progress-voltage
Fix: we might get a voltage bigger than max v and this will lead to n…
2 parents 2c171c5 + d851ac2 commit eca8cad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Profiling/Dialog/ProfilingDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export default ({ isVisible }: { isVisible: boolean }) => {
8888
0
8989
);
9090
const maxVDelta = profile.vUpperCutOff - profile.vLowerCutOff;
91-
const voltageProgress = Math.min((vDelta / maxVDelta) * 100, 100);
91+
const voltageProgress = Math.max(
92+
0,
93+
Math.min((vDelta / maxVDelta) * 100, 100)
94+
);
9295

9396
const millAmpHrProgress = Math.min(
9497
(theoreticalProgressMillAmpHr * alpha +

0 commit comments

Comments
 (0)