Skip to content

Commit 6a70b40

Browse files
committed
main.cpp: add check for StateC when charging with Auto 1P/3P switching logic (Master only)
1 parent 0663d8a commit 6a70b40

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

SmartEVSE-3/src/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ void CalcBalancedCurrent(char mod) {
12371237

12381238
// adapt IsetBalanced in Smart Mode, and ensure the MaxMains/MaxCircuit settings for Solar
12391239

1240-
if ((LoadBl == 0 && EVMeter.Type) || LoadBl == 1) // Conditions in which MaxCircuit has to be considered;
1240+
if ((LoadBl == 0 && EVMeter.Type) || (LoadBl == 1 && EVMeter.Type)) // Conditions in which MaxCircuit has to be considered;
12411241
// mode = Smart/Solar so don't test for that
12421242
Idifference = min((MaxMains * 10) - MainsMeter.Imeasured, (MaxCircuit * 10) - EVMeter.Imeasured);
12431243
else
@@ -1347,7 +1347,7 @@ void CalcBalancedCurrent(char mod) {
13471347
(Isum > (ActiveEVSE * MinCurrent * Nr_Of_Phases_Charging - StartCurrent) * 10 ||
13481348
// don't apply that rule if we are 3P charging and we could switch to 1P
13491349
(Nr_Of_Phases_Charging > 1 && EnableC2 == AUTO))) {
1350-
if (Nr_Of_Phases_Charging > 1 && EnableC2 == AUTO) {
1350+
if (Nr_Of_Phases_Charging > 1 && EnableC2 == AUTO && State == STATE_C) { // Only for Master when charging, Nodes are not supported yet
13511351
// not enough current for 3-phase operation; we can switch to 1-phase after some time
13521352
// start solar stop timer
13531353
if (SolarStopTimer == 0) {
@@ -1405,7 +1405,8 @@ void CalcBalancedCurrent(char mod) {
14051405
// ############### no shortage of power #################
14061406

14071407
// Solar mode with C2=AUTO and enough power for switching from 1P to 3P solar charge?
1408-
if (Mode == MODE_SOLAR && Nr_Of_Phases_Charging == 1 && EnableC2 == AUTO && IsetBalanced + 8 >= MaxCurrent * 10) {
1408+
// This is only relevant for the Master controller when charging, Nodes are not yet supported
1409+
if (Mode == MODE_SOLAR && Nr_Of_Phases_Charging == 1 && EnableC2 == AUTO && IsetBalanced + 8 >= MaxCurrent * 10 && State == STATE_C) {
14091410
// are we at max regulation at 1P (Iset hovers at 15.2-16.0A on 16A MaxCurrent)(warning: Iset can also be at max when EV limits current)
14101411
// and is there enough spare that we can go to 3P charging?
14111412
// Can it take the step from 1x16A to 3x7A (in regular config)?

0 commit comments

Comments
 (0)