Skip to content

Commit cdf9d89

Browse files
Merge pull request #1325 from Adminius/patch-11
Phases calculation fix
2 parents 31a3739 + 3b58af1 commit cdf9d89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

TeslaLogger/DBHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4932,7 +4932,7 @@ public static int CalculatePhases(int power, int voltage, int current)
49324932
if (power <= 0 || voltage <= 0 || current <= 0 )
49334933
return 0;
49344934

4935-
int phases = Convert.ToInt32(Math.Truncate((power * 1000.0 + 500) / voltage / current));
4935+
int phases = Convert.ToInt32(Math.Truncate(Math.Truncate((power * 1000.0 + 500) / voltage / current))+0.3);
49364936

49374937
if (phases > 3)
49384938
return 3;

0 commit comments

Comments
 (0)