Skip to content

Commit fe4bc6b

Browse files
author
dingo35
committed
main.cpp: make sure in Normal Mode, PwrShare enabled, MaxMains is NOT obeyed
1 parent 3e512fb commit fe4bc6b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SmartEVSE-3/src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ char IsCurrentAvailable(void) {
10051005
if (Baseload_EV < 0) Baseload_EV = 0; // so Baseload_EV = 0 when no EVMeter installed
10061006

10071007
// Check if the lowest charge current(6A) x ActiveEV's + baseload would be higher then the MaxMains.
1008-
if ((ActiveEVSE * (MinCurrent * 10) + Baseload) > (MaxMains * 10)) {
1008+
if (Mode != MODE_NORMAL && (ActiveEVSE * (MinCurrent * 10) + Baseload) > (MaxMains * 10)) {
10091009
_LOG_D("No current available MaxMains line %d. ActiveEVSE=%i, Baseload=%.1fA, MinCurrent=%iA, MaxMains=%iA.\n", __LINE__, ActiveEVSE, (float) Baseload/10, MinCurrent, MaxMains);
10101010
return 0; // Not enough current available!, return with error
10111011
}
@@ -1018,7 +1018,7 @@ char IsCurrentAvailable(void) {
10181018
bool must_be_single_phase_charging = (EnableC2 == ALWAYS_OFF || (Mode == MODE_SOLAR && EnableC2 == SOLAR_OFF) ||
10191019
(Mode == MODE_SOLAR && EnableC2 == AUTO && Switching_To_Single_Phase == AFTER_SWITCH));
10201020
int Phases = must_be_single_phase_charging ? 1 : 3;
1021-
if (MaxSumMains && ((Phases * ActiveEVSE * MinCurrent * 10) + Isum > MaxSumMains * 10)) {
1021+
if (Mode != MODE_NORMAL && MaxSumMains && ((Phases * ActiveEVSE * MinCurrent * 10) + Isum > MaxSumMains * 10)) {
10221022
_LOG_D("No current available MaxSumMains line %d. ActiveEVSE=%i, MinCurrent=%iA, Isum=%.1fA, MaxSumMains=%iA.\n", __LINE__, ActiveEVSE, MinCurrent, (float)Isum/10, MaxSumMains);
10231023
return 0; // Not enough current available!, return with error
10241024
}
@@ -1155,7 +1155,7 @@ void CalcBalancedCurrent(char mod) {
11551155
if (Mode == MODE_NORMAL) // Normal Mode
11561156
{
11571157
if (LoadBl == 1) // Load Balancing = Master? MaxCircuit is max current for all active EVSE's;
1158-
IsetBalanced = min((MaxMains * 10) - Baseload, (MaxCircuit * 10 ) - Baseload_EV);
1158+
IsetBalanced = (MaxCircuit * 10 ) - Baseload_EV;
11591159
// limiting is per phase so no Nr_Of_Phases_Charging here!
11601160
else
11611161
IsetBalanced = ChargeCurrent; // No Load Balancing in Normal Mode. Set current to ChargeCurrent (fix: v2.05)

0 commit comments

Comments
 (0)